erocci 
A scalable model-driven REST framework 
Jean Parpaillon <jean.parpaillon@free.fr> 
November 5th, 2014 erocci - Jean Parpaillon 1
REST API : a user point of view 
November 5th, 2014 erocci - Jean Parpaillon 2
REST API : a user point of view 
Data format 
JSON format 
XML format 
Scalar data types (string, integer, float, etc) 
Data access protocol 
Filtering 
Sorting 
Pagination 
Authnz (tokens, etc), return codes, etc. 
Finally... 
Application level : data types (structures, relations, etc) 
November 5th, 2014 erocci - Jean Parpaillon 3
REST API : a user point of view 
Data format 
Schémas ? 
JSON format 
XML format 
Scalar data types (string, integer, float, etc) 
Data access protocol 
Filtering 
Sorting 
Pagination 
Authnz (tokens, etc), return codes, etc. 
Finally... 
One to rule them all ? 
A single meta-model ? 
Application level : data types (structures, relations, etc) 
November 5th, 2014 erocci - Jean Parpaillon 4
Let's speak about a standard ? 
November 5th, 2014 erocci - Jean Parpaillon 5
Let's speak about a standard for REST 
A standard 
Is not a catalog of schemas 
Is not a constraint for developers 
Must be implemented (implementable) 
A good standard 
Should allow to concentrate on the design, not the 
implementation details 
Allow to build an ecosystem 
Allow to accelerate the development, not the contrary 
November 5th, 2014 erocci - Jean Parpaillon 6
The Open Cloud Computing Interface 
OCCI is typed 
A ressource is an instance of a kind 
A kind is a named list of typed attributes and actions 
e.g. : compute : # cores (integer), RAM (float), etc 
Attribute : name, type, default value, mutability, etc. 
Action : an invocable operation on a ressource 
Kinds are inheritable 
November 5th, 2014 erocci - Jean Parpaillon 7
The Open Cloud Computing Interface 
OCCI is extensible 
Resource can be associated with mixins 
Mixin: a named set of additional attributes and actions 
e.g. : IPNetworkInterface adds IP, netmask, etc to a 
network interface 
User Mixin : aka « tags » 
e.g. : http://example.com/occi/mixins#my_project1 
November 5th, 2014 erocci - Jean Parpaillon 8
The Open Cloud Computing Interface 
OCCI is relational 
Links are ressources with additional attributes 
occi.core.source : resource URI 
occi.core.target : URI 
A bounded collection is a list of ressources of the same 
kind/mixin : 
e.g. : GET /collections/compute/ 
An unbounded collection is a list of ressources with 
same prefx : 
e.g. : GET /myresources/ 
November 5th, 2014 erocci - Jean Parpaillon 9
The Open Cloud Computing Interface 
OCCI is self-described 
GET /-/ (capabilities) 
List of supported kinds 
List of supported mixins 
Capabilities returns collection's URL 
http://schemas.ogf.org/occi/infrastructure#compute → 
/collections/compute/ 
November 5th, 2014 erocci - Jean Parpaillon 10
The Open Cloud Computing Interface 
OCCI is meta-model based 
Model consistency checking 
Automatic model implementation 
Rendering independant 
text/plain, application/json, … 
Transport independant 
HTTP, ... 
November 5th, 2014 erocci - Jean Parpaillon 11
OCCI Ecosystem 
Framework 
rOCCI (ruby) 
occi4java (not maintained) 
Specifc implementations 
CompatibleOne 
PyOCNI 
OpenStack, OpenNebula, 
etc 
Limits 
Models are 
language/extensions/lib 
dependant 
See 
http://occi-wg/community/ 
implementations/ 
Tools 
DoYouSpeakOcci : tests 
Monitoring (Intel) 
November 5th, 2014 erocci - Jean Parpaillon 12
Why erocci ? 
Generic : a framework to build OCCI applications 
Less code, more design 
Small, tested, reliable 
Easy to deploy 
Scalable 
Runs embedded in connected objects (IoT) 
Scales out to serve millions of users 
Extensible 
November 5th, 2014 erocci - Jean Parpaillon 13
Architecture 
November 5th, 2014 erocci - Jean Parpaillon 14
Genericity 
Only OCCI meta-model is hard-coded 
Everything is pluggable : 
Authentication mechanism 
Transport protocol (HTTP, XMPP, etc) 
Data sources (backends) 
Allow composition of services by plugging data 
sources (backends) at runtime 
November 5th, 2014 erocci - Jean Parpaillon 15
Less code, more design 
A schema for ressources' categories (kinds, mixins) 
ACL-based authorizations 
November 5th, 2014 erocci - Jean Parpaillon 16
Small, tested, reliable 
Small 
Around 12k lines 
Tested 
Continuous integration 
Reliable 
Erlang cowboy web server (LeoFS, MongooseIM, etc) 
erlang/OTP platform provides fault tolerance 
Process supervision 
November 5th, 2014 erocci - Jean Parpaillon 17
Easy to deploy 
All included erlang/OTP platform 
Self contained : no web frontend 
Just try it ! 
November 5th, 2014 erocci - Jean Parpaillon 18
Scalable 
Thanks to erlang/OTP 
Runs on RaspberryPI (~ 100 req/sec) 
Scales out to a full cluster 
November 5th, 2014 erocci - Jean Parpaillon 19
Extensible 
Pluggable mechanisms 
For those who don't like erlang 
D-Bus backend API (experimental) 
November 5th, 2014 erocci - Jean Parpaillon 20
(1) use case : a REST backend for blog 
No need for ORM, web server, database, templating, 
etc. 
Design your model 
Blog entry kind 
User kind 
Contribution kind (link between a user and an entry) 
Choose a storage backend 
Choose a transport (HTTP?) 
Defnes ACL 
And that's all 
November 5th, 2014 erocci - Jean Parpaillon 21
(2) use case : API adapter 
Backend API : write a new data source for your API 
Erlang API 
D-Bus API (any language) 
In any case, implements CRUD operations 
Choose a transport 
Enjoy scalability, supervision, transports, ACL, etc. 
November 5th, 2014 erocci - Jean Parpaillon 22
(3) use case : a protocol adapter 
You have a resource oriented protocol and want to 
expose it through HTTP/OCCI 
Use occi_store for storing your data 
erocci deals with storage, rendering, scalability, ... 
November 5th, 2014 erocci - Jean Parpaillon 23
Roadmap 
Authn/authz 
x509 based authn 
oauth 
occi_store 
Optimizations 
Integrate authnz, 
pagination (wip) 
XMPP 
Enable pubsub 
(notifcations) 
New storage backends 
Riak (wip) 
ODBC (SQL) 
… 
Testing 
Improve functional tests 
Improve unit testing 
November 5th, 2014 erocci - Jean Parpaillon 24
Eco-system : OCCIware 
(1) consortium 
Research, industry, standardization 
(3) pillars 
Theory : proven meta-model (OCCI) 
Design : Eclipse-based tools 
Runtime : erocci, … 
(*) use cases 
IaaS, PaaS, SaaS, IoT, ... 
Every RESTful services 
November 5th, 2014 erocci - Jean Parpaillon 25
Resources 
Website (WIP) 
http://erocci.ow2.org/ 
Source code 
http://github.com/erocci/erocci 
Continuous integration 
https://travis-ci.org/jeanparpaillon/erocci 
Mailing lists 
erocci-dev@ow2.org / erocci-info@ow2.org 
November 5th, 2014 erocci - Jean Parpaillon 26
Thanks ! 
Questions ? 
November 5th, 2014 erocci - Jean Parpaillon 27

OW2con'14 - erOCCI, a scalable, model-based REST API framework

  • 1.
    erocci A scalablemodel-driven REST framework Jean Parpaillon <jean.parpaillon@free.fr> November 5th, 2014 erocci - Jean Parpaillon 1
  • 2.
    REST API :a user point of view November 5th, 2014 erocci - Jean Parpaillon 2
  • 3.
    REST API :a user point of view Data format JSON format XML format Scalar data types (string, integer, float, etc) Data access protocol Filtering Sorting Pagination Authnz (tokens, etc), return codes, etc. Finally... Application level : data types (structures, relations, etc) November 5th, 2014 erocci - Jean Parpaillon 3
  • 4.
    REST API :a user point of view Data format Schémas ? JSON format XML format Scalar data types (string, integer, float, etc) Data access protocol Filtering Sorting Pagination Authnz (tokens, etc), return codes, etc. Finally... One to rule them all ? A single meta-model ? Application level : data types (structures, relations, etc) November 5th, 2014 erocci - Jean Parpaillon 4
  • 5.
    Let's speak abouta standard ? November 5th, 2014 erocci - Jean Parpaillon 5
  • 6.
    Let's speak abouta standard for REST A standard Is not a catalog of schemas Is not a constraint for developers Must be implemented (implementable) A good standard Should allow to concentrate on the design, not the implementation details Allow to build an ecosystem Allow to accelerate the development, not the contrary November 5th, 2014 erocci - Jean Parpaillon 6
  • 7.
    The Open CloudComputing Interface OCCI is typed A ressource is an instance of a kind A kind is a named list of typed attributes and actions e.g. : compute : # cores (integer), RAM (float), etc Attribute : name, type, default value, mutability, etc. Action : an invocable operation on a ressource Kinds are inheritable November 5th, 2014 erocci - Jean Parpaillon 7
  • 8.
    The Open CloudComputing Interface OCCI is extensible Resource can be associated with mixins Mixin: a named set of additional attributes and actions e.g. : IPNetworkInterface adds IP, netmask, etc to a network interface User Mixin : aka « tags » e.g. : http://example.com/occi/mixins#my_project1 November 5th, 2014 erocci - Jean Parpaillon 8
  • 9.
    The Open CloudComputing Interface OCCI is relational Links are ressources with additional attributes occi.core.source : resource URI occi.core.target : URI A bounded collection is a list of ressources of the same kind/mixin : e.g. : GET /collections/compute/ An unbounded collection is a list of ressources with same prefx : e.g. : GET /myresources/ November 5th, 2014 erocci - Jean Parpaillon 9
  • 10.
    The Open CloudComputing Interface OCCI is self-described GET /-/ (capabilities) List of supported kinds List of supported mixins Capabilities returns collection's URL http://schemas.ogf.org/occi/infrastructure#compute → /collections/compute/ November 5th, 2014 erocci - Jean Parpaillon 10
  • 11.
    The Open CloudComputing Interface OCCI is meta-model based Model consistency checking Automatic model implementation Rendering independant text/plain, application/json, … Transport independant HTTP, ... November 5th, 2014 erocci - Jean Parpaillon 11
  • 12.
    OCCI Ecosystem Framework rOCCI (ruby) occi4java (not maintained) Specifc implementations CompatibleOne PyOCNI OpenStack, OpenNebula, etc Limits Models are language/extensions/lib dependant See http://occi-wg/community/ implementations/ Tools DoYouSpeakOcci : tests Monitoring (Intel) November 5th, 2014 erocci - Jean Parpaillon 12
  • 13.
    Why erocci ? Generic : a framework to build OCCI applications Less code, more design Small, tested, reliable Easy to deploy Scalable Runs embedded in connected objects (IoT) Scales out to serve millions of users Extensible November 5th, 2014 erocci - Jean Parpaillon 13
  • 14.
    Architecture November 5th,2014 erocci - Jean Parpaillon 14
  • 15.
    Genericity Only OCCImeta-model is hard-coded Everything is pluggable : Authentication mechanism Transport protocol (HTTP, XMPP, etc) Data sources (backends) Allow composition of services by plugging data sources (backends) at runtime November 5th, 2014 erocci - Jean Parpaillon 15
  • 16.
    Less code, moredesign A schema for ressources' categories (kinds, mixins) ACL-based authorizations November 5th, 2014 erocci - Jean Parpaillon 16
  • 17.
    Small, tested, reliable Small Around 12k lines Tested Continuous integration Reliable Erlang cowboy web server (LeoFS, MongooseIM, etc) erlang/OTP platform provides fault tolerance Process supervision November 5th, 2014 erocci - Jean Parpaillon 17
  • 18.
    Easy to deploy All included erlang/OTP platform Self contained : no web frontend Just try it ! November 5th, 2014 erocci - Jean Parpaillon 18
  • 19.
    Scalable Thanks toerlang/OTP Runs on RaspberryPI (~ 100 req/sec) Scales out to a full cluster November 5th, 2014 erocci - Jean Parpaillon 19
  • 20.
    Extensible Pluggable mechanisms For those who don't like erlang D-Bus backend API (experimental) November 5th, 2014 erocci - Jean Parpaillon 20
  • 21.
    (1) use case: a REST backend for blog No need for ORM, web server, database, templating, etc. Design your model Blog entry kind User kind Contribution kind (link between a user and an entry) Choose a storage backend Choose a transport (HTTP?) Defnes ACL And that's all November 5th, 2014 erocci - Jean Parpaillon 21
  • 22.
    (2) use case: API adapter Backend API : write a new data source for your API Erlang API D-Bus API (any language) In any case, implements CRUD operations Choose a transport Enjoy scalability, supervision, transports, ACL, etc. November 5th, 2014 erocci - Jean Parpaillon 22
  • 23.
    (3) use case: a protocol adapter You have a resource oriented protocol and want to expose it through HTTP/OCCI Use occi_store for storing your data erocci deals with storage, rendering, scalability, ... November 5th, 2014 erocci - Jean Parpaillon 23
  • 24.
    Roadmap Authn/authz x509based authn oauth occi_store Optimizations Integrate authnz, pagination (wip) XMPP Enable pubsub (notifcations) New storage backends Riak (wip) ODBC (SQL) … Testing Improve functional tests Improve unit testing November 5th, 2014 erocci - Jean Parpaillon 24
  • 25.
    Eco-system : OCCIware (1) consortium Research, industry, standardization (3) pillars Theory : proven meta-model (OCCI) Design : Eclipse-based tools Runtime : erocci, … (*) use cases IaaS, PaaS, SaaS, IoT, ... Every RESTful services November 5th, 2014 erocci - Jean Parpaillon 25
  • 26.
    Resources Website (WIP) http://erocci.ow2.org/ Source code http://github.com/erocci/erocci Continuous integration https://travis-ci.org/jeanparpaillon/erocci Mailing lists erocci-dev@ow2.org / erocci-info@ow2.org November 5th, 2014 erocci - Jean Parpaillon 26
  • 27.
    Thanks ! Questions? November 5th, 2014 erocci - Jean Parpaillon 27