Cloud (Anti)Patterns: OCCI Perspective
OCCI (anti)patterns represent the good and bad practices in the OCCI RESTful Protocol that we have identified by performing a rigorous and deep analysis on all principles defined under this specification. We distinguished three categories of (anti)patterns: Management Related (Anti)Patterns, Cloud Structure Related (Anti)Patterns, and OCCI REST Related (Anti)Patterns.
- Management related (anti)patterns
- Query interface support vs Missing query interface
- Compliant Create vs. Non-Compliant Create
- Compliant Trigger Action vs. Non-Compliant Trigger Action
- Compliant Update vs. Non-Compliant Update
- Compliant Delete vs. Non-Compliant Delete
- Compliant Retrieve vs. Non-Compliant Retrive
- Cloud Structure related (anti)patterns
- Compliant Link between Resources vs.Non-Compliant Link between Resources
- Compliant Association of resource(s) with Mixin vs. Non-compliant Association of resource(s) With Mixin
- Compliant Dissociation of resource(s) From Mixin vs. Non-compliant dissociation of resource(s) From Mixin
- OCCI REST related (anti)patterns
- Compliant URL vs. Non-Compliant URL
- Compliant Request Header vs. Non-Compliant Request Header
- Compliant Response Header vs. Non- Compliant Response Header
Cloud (Anti)Patterns: REST Perspective
REST (anti)patterns represent the good and bad practices in the REST APIs regardless of any cloud standard. We distinguished five categories of (anti)patterns: URI (anti)patterns, HTTP methods (anti)patterns, Error Handling (anti)patterns, HTTP Header (anti)patterns, Hypermedia (anti)patterns.
- URI (anti)patterns
- Verbless URIs vs. CRUDy URIs
- Tidy URIs vs. Amorphous URIs
- Compliant Update vs. Non-Compliant Update
- Singularized nodes vs. pluralized nodes
- HTTP methods (anti)patterns
- Correct use of POST, GET, PUT, DELETE, HEAD vs. Tunneling every things through GET and POST
- Error handling (Anti)Patterns
- Supporting Status Code vs. Ignoring Status Code
- HTTP Header (Anti)Patterns
- Supporting Caching vs. Ignoring Caching
- Supporting MIME Types vs. Ignoring MIME Types
- Hypermedia (Anti)Patterns
- Supporting Hypermedia vs. Forgetting Hypermedia
Examples of semantic detection rules
SWRL Rules for Query interface support pattern and Missing query interface anti-pattern
(Anti)patterns | SWRL rules |
---|---|
Query interface support pattern | Rest:API(?ap)^ Rest:ComposedOf(?ap,?operation)^ Rest:hasURL(?operation, ?url)^ Rest:value(?url, ?urlval)^ swrlb:matches(?urlval,“\-\”)^ Rest:hasHttpMethod(? operation, ?httpmethod)^ Rest:verb(?httpmethod, ?verb)^ detection:matchesOne(?verb, “POST”, “PUT”, “GET”, “DELETE”)->Rest:hasPattern(?ap, Ptt:Query_interface_support) |
Missing query interface anti-pattern | Rest:API(?ap)^ Rest:ComposedOf(?ap, ?operation)^ Rest:hasURL(?operation,?url)^Rest:value(?url, “\-\” )^ sqwrl:makeSet(?s1, ?url)^sqwrl:isEmpty(?s1) ->Rest:hasAntiPattern(?ap, Att:Missing_query_interface) |
SWRL rules for Compliant Trigger Action pattern and Non-Compliant Trigger Action anti-pattern
(Anti)patterns | SWRL rules |
---|---|
Compliant Trigger Action | Rest:Operation(?op) ^ Rest:type(?op, "Trigger Action") ^ Rest:hasHttpMethod(?op, ?httpmd) ^ Rest:verb(?httpmd, ?verb) ^ swrlb:matches(?verb, "POST") ^ Rest:hasRequest(?op, ?req) ^ Rest:hasRq-Body(?req, ?reqbody) ^ Rest:hasParameterDefinition(?reqbody, ?pradef) ^ Occi:Action(?action) ^ Rest:isComposedOf(?pradef, ?action) ^ Occi:term(?action, ?term) ^ Occi:scheme(?action, ?scheme) ^ Occi:class(?action, "action") ^ Rest:hasURL(?op, ?url) ^ Rest:value(?url, ?value) ^ swrlb:contains(?value, "action=") ^ swrlb:endsWith(?value, ?term) -> Rest:hasPattern(?op, Ptt:Compliant_Trigger_Action) |
Non-Compliant Trigger Action anti-pattern | Rest:Operation(?op) ^ Rest:type(?op, "Trigger Action") ^ Rest:hasHttpMethod(?op, ?httpmd)
^ Rest:verb(?httpmd, ?verb) ^ swrlb:notEqual(?verb, "POST")
Rest:hasAntipattern(?op, Att:Non-CompliantTriggerAction) - Rest:Operation(?op)^Rest:type(?op, "Trigger Action")^Rest:hasURL(?op, ?url) ^ Rest:value(?url, ?value) ^ detection:notcontains(?value, "action=") -> Rest:hasAntiPattern(?op, Ptt:Non-Compliant_Trigger_Action) |
SWRL rules for Verbless URIs pattern and CRUDy URIs anti-pattern
(Anti)patterns | SWRL rules |
---|---|
Verbless URIs pattern | Rest:Operation(?operation)^ Rest:hasHttpMethod(? operation, ?httpmethod) ^ Rest:verb(?httpmethod, ?verb) ^detection:matchesOne(?verb, "POST", " PUT", "GET", "DELETE") ^ Rest:hasURL(?operation, ?url)^ Rest:value(?url,?urlval)^ detection: contain(?return,?urlval, "create", "update", " read", "delete") ^ swrlb:matches(?return, "False ")->Rest:hasPattern(?operation, Ptt: Verbless_URIs) |
CRUDy URIs anti-pattern | - Rest:Operation(?operation) ^ Rest:hasHttpMethod(?
operation, ?httpmethod) ^ Rest:verb(?httpmethod,
?verb) ^ detection:matchesOne (?verb, "create",
"update", "read", "delete")^Rest:
hasAntipattern (?operation, Att:CRUDy_URIs)
-Rest:Operation(?operation) ^ Rest:hasURL(? operation, ?url) ^ Rest:value(?url,?urlval) ^ detection:contain(?return,?urlval, "create", " update", "read", "delete") ^ swrlb:matches(? return, "True")->Rest:hasAntipattern (?operation, Att:CRUDy_URIs) |
SWRL rules for Tunneling every things through GET and POST anti-patterns
(Anti)patterns | SWRL rules |
---|---|
Tunneling every things through GET anti-pattern | Rest:Operation(?op) ^ Rest:hasHttpMethod(?op, ?httpmethod) ^ Rest:verb(?httpmethod, ?verb) ^ swrlb:matches(?verb, "GET") ^ Rest:URL(?url) ^ Rest:value(?url, ?urlval) ^ detection:contain(?return, ?urlval, "delete", "update", "head", "put") ^ swrlb:matches(?return, "True")-> Rest:hasAntipattern(?url, Att:Tunnelling_every_things_through_GET) |
Tunneling every things through POST anti-pattern | - Rest:Operation(?op) ^ Rest:hasHttpMethod(?op, ?httpmethod) ^ Rest:verb(?httpmethod, ?verb) ^ swrlb:matches(?verb, "POST") ^ Rest:URL(?url) ^ Rest:value(?url, ?urlval) ^ detection:contain(?return, ?urlval, "delete", "update", "head", "put") ^ swrlb:matches(?return, "True")-> Rest:hasAntipattern(?url, Att:Tunnelling_every_things_through_POST) |
SWRL rules for Ignoring Status Code pattern and Supporting Status Code anti-pattern
(Anti)patterns | SWRL rules |
---|---|
Supporting Status Code pattern | Rest:Operation(?op) ^ Rest:hasCode(?op, ?codestatus) ^ Rest:value(?codestatus, ?value) ^ detection:matchelist(?value, "200 (OK), 201 (Created), 201 (Created), 202 (Accepted), 204 (No Content), 204 (No Content), 304 (Not Modified), 400 (Bad Request)") -> Rest:hasPattern(?op, Ptt:Supporting_Status_Code) |
Ignoring Status Code anti-pattern | - Rest:Operation(?op) ^ Rest:hasCode(?op, ?codestatus) ^ Rest:value(?codestatus, ?value)
^ detection:Notmatchelist(?value, "200 (OK), 201 (Created), 201 (Created), 202 (Accepted), 204 (No Content), 204 (No Content), 304 (Not Modified),
400 (Bad Request)") -> Rest:hasPattern(?op, Att:Ignoring_Status_Code) -Rest:Operation(?op) ^ Rest:hasCode(?op, ?codestatus) ^ Rest:value(?codestatus, ?value) ^ swrlb:matches(?value, " ") -> Rest:hasPattern(?op, Att:Ignoring_Status_Code) |
Contact
-
Hayet Brabra
Telecom SudParis
Computer Science Departement
email: hayet.brabra (-at-) telecom-sudparis.eu