ow2con'14 - erocci, a scalable, model-based rest api framework

27
November 5th, 2014 erocci - Jean Parpaillon 1 erocci A scalable model-driven REST framework Jean Parpaillon <[email protected]>

Upload: ow2-consortium

Post on 05-Jul-2015

131 views

Category:

Technology


0 download

TRANSCRIPT

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

November 5th, 2014 erocci - Jean Parpaillon 1

erocci

A scalable model-driven REST framework

Jean Parpaillon <[email protected]>

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

November 5th, 2014 erocci - Jean Parpaillon 2

REST API : a user point of view 

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

November 5th, 2014 erocci - Jean Parpaillon 3

REST API : a user point of view 

Data formatJSON formatXML formatScalar data types (string, integer, float, etc)

Data access protocolFilteringSortingPaginationAuthnz (tokens, etc), return codes, etc.

Finally...Application level : data types (structures, relations, etc) 

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

November 5th, 2014 erocci - Jean Parpaillon 4

REST API : a user point of view 

Data formatJSON formatXML formatScalar data types (string, integer, float, etc)

Data access protocolFilteringSortingPaginationAuthnz (tokens, etc), return codes, etc.

Finally...Application level : data types (structures, relations, etc) 

Schémas ? 

One to rule them all ? 

A single meta-model ? 

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

November 5th, 2014 erocci - Jean Parpaillon 5

Let's speak about a standard ? 

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

November 5th, 2014 erocci - Jean Parpaillon 6

Let's speak about a standard for REST

A standardIs not a catalog of schemasIs not a constraint for developersMust be implemented (implementable)

A good standardShould allow to concentrate on the design, not the implementation detailsAllow to build an ecosystemAllow to accelerate the development, not the contrary

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

November 5th, 2014 erocci - Jean Parpaillon 7

The Open Cloud Computing Interface

OCCI is typedA ressource is an instance of a kindA 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

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

November 5th, 2014 erocci - Jean Parpaillon 8

The Open Cloud Computing Interface

OCCI is extensibleResource can be associated with mixinsMixin: 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 

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

November 5th, 2014 erocci - Jean Parpaillon 9

The Open Cloud Computing Interface

OCCI is relationalLinks 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/ 

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

November 5th, 2014 erocci - Jean Parpaillon 10

The Open Cloud Computing Interface

OCCI is self-describedGET /-/ (capabilities)

List of supported kindsList of supported mixins

Capabilities returns collection's URLhttp://schemas.ogf.org/occi/infrastructure#compute → /collections/compute/

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

November 5th, 2014 erocci - Jean Parpaillon 11

The Open Cloud Computing Interface

OCCI is meta-model basedModel consistency checkingAutomatic model implementationRendering independant

text/plain, application/json, …Transport independant

HTTP, ...

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

November 5th, 2014 erocci - Jean Parpaillon 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)

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

November 5th, 2014 erocci - Jean Parpaillon 13

Why erocci ? 

Generic : a framework to build OCCI applications Less code, more designSmall, tested, reliableEasy to deployScalable

Runs embedded in connected objects (IoT)Scales out to serve millions of users

Extensible

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

November 5th, 2014 erocci - Jean Parpaillon 14

Architecture

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

November 5th, 2014 erocci - Jean Parpaillon 15

Genericity

Only OCCI meta-model is hard-codedEverything is pluggable : 

Authentication mechanismTransport protocol (HTTP, XMPP, etc)Data sources (backends)

Allow composition of services by plugging data sources (backends) at runtime

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

November 5th, 2014 erocci - Jean Parpaillon 16

Less code, more design

A schema for ressources' categories (kinds, mixins)ACL-based authorizations

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

November 5th, 2014 erocci - Jean Parpaillon 17

Small, tested, reliable

SmallAround 12k lines

TestedContinuous integration

ReliableErlang cowboy web server (LeoFS, MongooseIM, etc)erlang/OTP platform provides fault toleranceProcess supervision

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

November 5th, 2014 erocci - Jean Parpaillon 18

Easy to deploy

All included erlang/OTP platformSelf contained : no web frontend Just try it ! 

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

November 5th, 2014 erocci - Jean Parpaillon 19

Scalable

Thanks to erlang/OTPRuns on RaspberryPI (~ 100 req/sec)Scales out to a full cluster

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

November 5th, 2014 erocci - Jean Parpaillon 20

Extensible

Pluggable mechanismsFor those who don't like erlang

D-Bus backend API (experimental)

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

November 5th, 2014 erocci - Jean Parpaillon 21

(1) use case : a REST backend for blog 

No need for ORM, web server, database, templating, etc.Design your model

Blog entry kindUser kindContribution kind (link between a user and an entry)

Choose a storage backendChoose a transport (HTTP?)Defnes ACLAnd that's all

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

November 5th, 2014 erocci - Jean Parpaillon 22

(2) use case : API adapter 

Backend API : write a new data source for your API Erlang APID-Bus API (any language)In any case, implements CRUD operations

Choose a transportEnjoy scalability, supervision, transports, ACL, etc.

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

November 5th, 2014 erocci - Jean Parpaillon 23

(3) use case : a protocol adapter 

You have a resource oriented protocol and want to expose it through HTTP/OCCIUse occi_store for storing your dataerocci deals with storage, rendering, scalability, ...

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

November 5th, 2014 erocci - Jean Parpaillon 24

Roadmap

Authn/authzx509 based authnoauth

occi_storeOptimizationsIntegrate authnz, pagination (wip)

XMPPEnable pubsub (notifcations)

New storage backendsRiak (wip)ODBC (SQL)…

TestingImprove functional testsImprove unit testing

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

November 5th, 2014 erocci - Jean Parpaillon 25

Eco-system : OCCIware 

(1) consortiumResearch, industry, standardization

(3) pillarsTheory : proven meta-model (OCCI) Design : Eclipse-based tools Runtime : erocci, … 

(*) use casesIaaS, PaaS, SaaS, IoT, ...Every RESTful services

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

November 5th, 2014 erocci - Jean Parpaillon 26

Resources

Website (WIP)http://erocci.ow2.org/

Source codehttp://github.com/erocci/erocci

Continuous integrationhttps://travis-ci.org/jeanparpaillon/erocci

Mailing [email protected] / [email protected]

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

November 5th, 2014 erocci - Jean Parpaillon 27

Thanks ! 

Questions ?