ow2con'14- erocci, a scalable, model-based rest api framework
DESCRIPTION
While REST architecture has been widely adopted for web services, the lack of standard formalism for their description prevents from implementations interoperability. The erocci framework, based on erlang/OTP platform, implements the OCCI specification for building interoperable, self-documented web services. Building a scalable web service is as simple as describing your application model in an XML document and choosing amongst existing data backend. It can be extended in various ways to adapt to data sources (database, 3rd party web services, DBUS APIs, etc.), protocols (HTTP, XMPP, etc.), authentication mechanisms, etc.TRANSCRIPT
©2014JeanParpaillon
1
©2014JeanParpaillon
LET'SGOCLOUDWATCHING
ISCLOUDVIRTUALIZATION?ISCLOUDSTORAGE?ISCLOUDWEB++?
2
©2014JeanParpaillon
CLOUDISREST...
intcreate_vm(char*name,intcores,intmem);
defget_bucket(size)
module:erase_stuff/3
GEThttp://example.com/bucket?size=12
PUThttp://example.com/vm{"name":"myvm1","cores":4,"mem":2.5}
DELETEhttp://example.com/stuff/id1
objectoriented
relationaltables
relationaltables
Resourceoriented
factorypattern
builder iteratorobserver
C(reate)R(ead)U(pdate)D(elete)
3
©2014JeanParpaillon
...SOISEROCCI
PUT/myresource/id1
CREATE
POST/myresource/id1
UPDATE
GET/myresource/id1
READ
DELETE/myresource/id1
DELETE
4
©2014JeanParpaillon
"YETANOTHERRESTFRAMEWORK"?
RESTAPIslookssimilar,butarenotinteroperable
5
©2014JeanParpaillon
OCCIISTYPED
Kind:anamedlistofattributesandactionse.g.:http://schemas.ogf.org/occi/infrastructure#compute
Attribute:name,type(string,numeric,etc),mutability,occurrence,defaultvalue
Resource:aninstanceofakind,identifiedwithaURI
Action:aninvocableoperationapplicabletoaresource
e.g.:http://schemas.ogf.org/occi/infrastructure/compute/action#start
Kindsareinheritable
Inheritsattributesandactions
6
©2014JeanParpaillon
OCCIISEXTENSIBLE
Mixin:anamedsetofadditionalattributesandactionse.g.:http://schemas.ogf.org/occi/infrastructure/networkinterface#ipnetworkinterface
Resourcecanbeassociatedwithoneorseveralmixin
UserMixin:ausercancreateitsownmixin,totagresourcese.g.:http://example.com/occi/mixins#my_group1
7
©2014JeanParpaillon
OCCIISRELATIONAL
Linksareresourceswithspecificattributes:occi.core.source:resourceURIocci.core.target:resourceURI
AcollectionisalistofresourceURIsofthesamekind/mixinGET/collections/compute/GET/collections/os_tpl/
8
©2014JeanParpaillon
OCCIISSELF-DESCRIBED
GET/-/(capabilities)Listofsupportedkinds+descriptionListofsupportedmixins+descriptionListofsupportedactions+description
Capabilitiesshowcollection'sURLhttp://schemas.ogf.org/occi/infrsatructure#compute->/collections/compute
9
©2014JeanParpaillon
OCCIISMETA-MODELBASED
Categoryscheme:URIterm:Stringtitle:String[0..1]
Kind MixinAction
Entityid:URI
Resource Link
Attributename:Stringtype: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
1kind
*entities
1 target
1 source *links
0..1parent
*
*depends
*
1 *attributes
* applies
Modelconsistencychecking
Renderingindependant
text/plain,application/json,etc.
Transportindependant
HTTP,others...
Automaticmodelimplementation
10
©2014JeanParpaillon
OCCIIMPLEMENTATIONS
rOCCIocci4java
Frameworks
DoYouSpeakOCCI:test
Tools
CompatibleOnepyOCNIOpenStack,OpenNebula,etc
Specificimplementations
Modelsarelanguageextensions/libsHardtoexchangemodels:whataboutinteroperability?
Limits
Seehttp://occi-wg.org/community/implementations/
11
occi_store
occi_backend
supervisor
occi_backend_riak
backend
occi_backend_mnesia
backend
/
/path/to/resources
mount
createloadupdatedelete
occi_hook
supervisor
call
on_saveon_loadon_updateon_deleteon_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_listenerbasedoncowboy basedonexmpp
occi_category_mgr
supervisorcategoriesdescription
<?xml><occi:extension>
<occi:kind>...
</occi:kind>
</occi:extension>load
APPLICA
TIO
NM
OD
EL
STANDARDOCCIAPI
STORAGE
occi_backend_XXX
backend
PROPRIETARYAPI
/other/path/to/resources
©2014JeanParpaillon
EROCCIARCHITECTURE12
©2014JeanParpaillon
MULTIPLEREPRESENTATIONS
text/plain
Writeyourownrendering:
Implements:render,parse
text/occi
application/json(draft)
application/xml(experimental):seeXSD:https://github.com/jeanparpaillon/occi-schemas
13
/
/store/db1
/store/db2
/virt
occi_backend_mnesia
occi_backend_riak
occi_backend_odbc
occi_backend_libvirt
©2014JeanParpaillon
MULTIPLEBACKENDS
Backendsattachedtomountpoints
Backendsdeclareaschema
Storagebackend:user-definedschemaAPIadapter:backendspecificschema
SimplebackendAPI
ImplementsCRUDoperations
Sharedkinds/mixins
Collectionrequestsruninparallel
14
©2014JeanParpaillon
MULTIPLETRANSPORTS
HTTP(S)
NaturalRESTtransport
cowboywebserver
100%erlang(easytoport)
Small,tested,scalable
(distributed)
XMPP
IdealforM2M,IoT
Basedonforkedexmpp(erim)
<iq/>based
XMLschemaavailable
Extensible
SimpleAPIsfor:
-dispatchingrequests(occi_store)
-parsing/rendering
Faulttolerant:
-erlangsupervisor'ed
15
©2014JeanParpaillon
EXTENDINGEROCCI
ASAREST"ORM"
Chooseastoragebackend
LoadOCCIschemaasXML
Choosealistener
Startit!
ASAPIADAPTOR
Writeyourownbackend
ImplementsCRUDoperations
w/callstoyourfavouriteAPI
NEWTRANSPORT
Shareyourmodel
Justtransportitdifferently
->Noerlangneeded!
->Needtowriteerlang(noharm)
->Enjoyscalability,faulttolerance,transports,etc.
16
©2014JeanParpaillon
ROADMAP
authn/authzx509,HTTPbasicetc,XMPProsters,oauth/openid,etc.POSIXbasedwithfile-basedbackend?
Contributionswelcome!
TestingFunctionaltests:migratetoCommonTestUnittests:useeunit,addtestsPOSIXbasedwithfile-basedbackend?
Optimizeocci_store
NewstoragebackendsRiak(started...)ODBC(SQL)etc.
XMPPlistenerXMPPcomponent(APIproxy)Implementsrosters,presence,etc
17
©2014JeanParpaillon
RESOURCES
Website:
Sourcecode:
Continuousintegration:
Mailinglists:
http://erocci.ow2.org
http://github.com/jeanparpaillon/erocci
https://travis-ci.org/jeanparpaillon/erocci
[email protected] [email protected]
(ongoingwork)
18
©2014JeanParpaillon
THANKS19