diff options
author | Tian Lee <TianL@amdocs.com> | 2017-11-23 09:35:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-11-23 09:35:54 +0000 |
commit | f7b84df35a767b18b8c5f3485cff2ffd5faab0c8 (patch) | |
tree | 246e698f758c5354f59edcbcdf4f42ba1a3781dd | |
parent | 94cbd3286b5fdd2f3f8fa3325835e713d71aac73 (diff) | |
parent | e40c8844c8868d189903adfe2d16cac8fa9bad6a (diff) |
Merge "Update README"
-rw-r--r-- | BULK.md | 141 | ||||
-rw-r--r-- | EDGE.md | 327 | ||||
-rw-r--r-- | README.md | 612 | ||||
-rw-r--r-- | VERTEX.md | 280 |
4 files changed, 759 insertions, 601 deletions
@@ -0,0 +1,141 @@ +## Bulk API + +The bulk API allows a client to add/update/delete mutliple verticies and/or edges within a single request. This request will be treated as an atomic transaction in that all operations within the bulk request will either fail or succeed together. + +This is often useful when attempting to add an entire subgraph. The following example shows how a client could create 2 verticies (pserver and vserver) and link them with an edge. + + URL: https://<host>:9520/services/inventory/v11/bulk + Method: POST + Body: + { + "objects":[ + { + "operation":"add", + "v1":{ + "type":"vserver", + "properties":{ + "in-maint":false, + "vserver-name":"vserver1", + "prov-status":"Provisioned", + "vserver-id":"Vserver-AMT-002-HSGW", + "vserver-name2":"Vs2-HSGW-OTT", + "vserver-selflink":"AMT VserverLink", + "is-closed-loop-disabled":false + } + } + }, + { + "operation":"add", + "v2":{ + "type":"pserver", + "properties":{ + "ptnii-equip-name":"ps1993", + "hostname":"pserver1", + "equip-type":"server", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "in-maint":false, + "fqdn":"pserver1.lab.com", + "ipv4-oam-address":"199.1.138.60" + } + } + } + ], + "relationships":[ + { + "operation":"add", + "e1":{ + "type":"tosca.relationships.HostedOn", + "source":"$v1", + "target":"$v2", + "properties":{ + "contains-other-v": "NONE", + "delete-other-v": "NONE", + "SVC-INFRA": "OUT", + "prevent-delete": "IN" + } + } + } + ] + } + + Success Response: + Code: 200 + Content: + { + "objects": [ + { + "operation": "add", + "v1": { + "id": "1024143488", + "type": "vserver", + "url": "services/inventory/v11/vserver/1024143488", + "properties": { + "in-maint":false, + "vserver-name":"vserver1", + "prov-status":"Provisioned", + "vserver-id":"Vserver-AMT-002-HSGW", + "vserver-name2":"Vs2-HSGW-OTT", + "vserver-selflink":"AMT VserverLink", + "is-closed-loop-disabled":false + }, + "in": [], + "out": [] + } + }, + { + "operation": "add", + "v2": { + "id": "1228865600", + "type": "pserver", + "url": "services/inventory/v11/pserver/1228865600", + "properties": { + "ptnii-equip-name":"ps1993", + "hostname":"pserver1", + "equip-type":"server", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "in-maint":false, + "fqdn":"pserver1.lab.com", + "ipv4-oam-address":"199.1.138.60" + }, + "in": [], + "out": [] + } + } + ], + "relationships": [ + { + "operation": "add", + "e1": { + "id": "kbrs40-gxqy68-108id-kbmurk", + "type": "tosca.relationships.HostedOn", + "url": "services/inventory/relationships/v11/tosca.relationships.HostedOn/kbrs40-gxqy68-108id-kbmurk", + "source": "services/inventory/v11/vserver/1024143488", + "target": "services/inventory/v11/pserver/1228865600", + "properties": { + "SVC-INFRA": "OUT", + "prevent-delete": "IN", + "delete-other-v": "NONE", + "contains-other-v": "NONE" + } + } + } + ] + } + + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. @@ -0,0 +1,327 @@ +## Edge APIs + +### Create Edge + +When creating an edge, the CRUD service will validate: +* properties match the defined schema +* relationship is valid between the source and target + + URL: https://<host>:9520/services/inventory/relationships/v11/tosca.relationships.HostedOn/ + Method: POST + Body: + { + "source":"services/inventory/v11/vserver/0", + "target":"services/inventory/v11/pserver/7", + "properties":{ + "SVC-INFRA": "OUT", + "prevent-delete": "IN", + "delete-other-v": "NONE", + "contains-other-v": "NONE" + } + } + Success Response: + Code: 201 + Content: + { + "id":"215x5m-6hc-d6vp-oe08g", + "type":"tosca.relationships.HostedOn", + "url":"services/inventory/relationships/v11/has/215x5m-6hc-d6vp-oe08g", + "source":"services/inventory/v11/vserver/0", + "target":"services/inventory/v11/pserver/7", + "properties":{ + "SVC-INFRA": "OUT", + "prevent-delete": "IN", + "delete-other-v": "NONE", + "contains-other-v": "NONE" + } + } + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +Optionally, an edge can be created by posting to an endpoint which doesn't include the edge type. + + URL: https://<host>:9520/services/inventory/relationships/v11/ + Method: POST + Body: + { + "type":"tosca.relationships.HostedOn", + "source":"services/inventory/v11/vserver/0", + "target":"services/inventory/v11/pserver/7", + "properties":{ + "SVC-INFRA": "OUT", + "prevent-delete": "IN", + "delete-other-v": "NONE", + "contains-other-v": "NONE" + } + } + Success Response: + Code: 201 + Content: Same as above + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Create Edge With Auto-Population Of Edge Properties +An alternate endpoint exists for creating edges which follows all of the conventions of the above endpoints, with the addition that properties defined in the db edge rules produced by the A&AI will be automatically populated for the edge. + + URL: https://<host>:9520/services/resources/relationships/tosca.relationships.HostedOn/ + Method: POST + Body: + { + "source":"services/inventory/v11/vserver/0", + "target":"services/inventory/v11/pserver/7", + "properties":{ + + } + } + Success Response: + Code: 201 + Content: + { + "id":"215x5m-6hc-d6vp-oe08g", + "type":"tosca.relationships.HostedOn", + "url":"services/inventory/relationships/v11/has/215x5m-6hc-d6vp-oe08g", + "source":"services/inventory/v11/vserver/0", + "target":"services/inventory/v11/pserver/7", + "properties":{ + "SVC-INFRA": "OUT", + "prevent-delete": "IN", + "delete-other-v": "NONE", + "contains-other-v": "NONE" + } + } + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +The same option to POST to an endpoint without specifying a type in the URL exists for this endpoint as well: + + URL: https://<host>:9520/services/resources/relationships/ + Method: POST + Body: + { + "type":"tosca.relationships.HostedOn", + "source":"services/inventory/v11/vserver/0", + "target":"services/inventory/v11/pserver/7", + "properties":{ + "SVC-INFRA": "OUT", + "prevent-delete": "IN", + "delete-other-v": "NONE", + "contains-other-v": "NONE" + } + } + Success Response: + Code: 201 + Content: Same as above + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Get Edge + + URL: https://<host>:9520/services/inventory/relationships/v11/tosca.relationships.HostedOn/<id> + Method: GET + Success Response: + Code: 200 + Content: + { + "id":"215x5m-6hc-d6vp-oe08g", + "type":"tosca.relationships.HostedOn", + "url":"services/inventory/relationships/tosca.relationships.HostedOn/has/215x5m-6hc-d6vp-oe08g", + "source":"services/inventory/v11/vserver/8400", + "target":"services/inventory/v11/pserver/40964272", + "properties":{ + "SVC-INFRA": "OUT", + "prevent-delete": "IN", + "delete-other-v": "NONE", + "contains-other-v": "NONE" + } + } + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource Not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Get Edges + + URL: https://<host>:9520/services/inventory/relationships/v11/tosca.relationships.HostedOn + Optional Query Param: ?multiplicity=many + Method: GET + Success Response: + Code: 200 + Content: + [ + { + "id":"1crwnu-6hc-d6vp-oe08g", + "type":"tosca.relationships.HostedOn", + "url":"services/inventory/relationships/v11/tosca.relationships.HostedOn/1crwnu-6hc-d6vp-oe08g", + "source":"services/inventory/v11/vserver/8400", + "target":"services/inventory/v11/pserver/40964272" + }, + { + "id":"215x5m-6hc-d6vp-oe08g", + "type":"tosca.relationships.HostedOn", + "url":"services/inventory/relationships/v11/tosca.relationships.HostedOn/215x5m-6hc-d6vp-oe08g", + "source":"services/inventory/v11/vserver/8400", + "target":"services/inventory/v11/pserver/40964272" + } + ] + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource Not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Update Edge + +The PUT command is used to modify an existing edge. By default, the edge data is replaced by the content of the payload. However, the following parameter can be added to the header to perform a PATCH instead of a replace: +**X-HTTP-Method-Override=Patch** + + URL: https://<host>:9520/services/inventory/relationships/v11/tosca.relationships.HostedOn/<id> + Method: PUT + Body: (**Note that the source and target can not be modified) + { + "properties":{ + "SVC-INFRA": "OUT", + "prevent-delete": "IN", + "delete-other-v": "NONE", + "contains-other-v": "NONE" + } + } + Success Response: + Code: 200 + Content: Same as POST + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Patch Edge + + URL: https://<host>:9520/services/inventory/relationships/v11/tosca.relationships.HostedOn/<id> + Method: PATCH (Content-Type header set to application/merge-patch+json) + Body: + { + "properties":{ + "prevent-delete":"OUT" + } + } + Success Response: + Code: 200 + Content: Same as POST + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Delete Edge + + URL: https://<host>:9520/services/inventory/relationships/v11/tosca.relationships.HostedOn/<id> + Method: DELETE + Success Response: + Code: 200 + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. +
\ No newline at end of file @@ -1,4 +1,4 @@ -runsOnPserverrunsOnPserver# CRUD Microservice (Gizmo) +# CRUD Microservice (Gizmo) ## Overview The CRUD microservice implements a set of RESTful APIs which allow a client to perform CREATE, UPDATE, GET, and DELETE operations on verticies and edges within the A&AI graph database. @@ -108,609 +108,19 @@ Where, Method: GET Success Response: 200 -### Create Vertex +### Vertex APIs +Gizmo exposes a set of APIs to operate on verticies within the graph. +[Vertex APIs](./VERTEX.md) -Vertex payload data is validated against oxm. -* Mandatory attributes are required in payload -* Data type validation is enforced -* Defaults from oxm schema used when not specified in payload +### Edge APIs +Gizmo exposes a set of APIs to operate on edges within the graph. +[Edge APIs](./EDGE.md) - URL: https://<host>:9520/services/inventory/v8/pserver/ - Method: POST - Body: - { - "properties":{ - "ptnii-equip-name":"e-name", - "equip-type":"server", - "hostname":"myhost", - "equip-vendor":"HP", - "equip-model":"DL380p-nd", - "fqdn":myhost.onap.net", - "purpose":"my-purpose", - "resource-version":"1477013499", - "ipv4-oam-address":"1.2.3.4" - } - } - Success Response: - Code: 201 - Content: - { - "id":"1130672", - "type":"pserver", - "url":"services/inventory/v8/pserver/1130672", - "properties":{ - "ptnii-equip-name":"e-name", - "equip-type":"server", - "hostname":"myhost", - "equip-vendor":"HP", - "equip-model":"DL380p-nd", - "fqdn":myhost.onap.net", - "purpose":"my-purpose", - "resource-version":"1477013499", - "ipv4-oam-address":"1.2.3.4" - } - } - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. +### Bulk API +Gizmo exposes a bulk API to operate on multiple graph entities within a single request. +[Bulk API](./BULK.md) + - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -Optionally, a vertex can be created by posting to an endpoint which doesn't include the vertex type. - - URL: https://<host>:9520/services/inventory/v8/ - Method: POST - Body: - { - "type":"pserver", - "properties":{ - "ptnii-equip-name":"e-name", - "equip-type":"server", - "hostname":"myhost", - "equip-vendor":"HP", - "equip-model":"DL380p-nd", - "fqdn":myhost.onap.net", - "purpose":"my-purpose", - "resource-version":"1477013499", - "ipv4-oam-address":"1.2.3.4" - } - } - Success Response: - Code: 201 - Content: - { - "id":"1130672", - "type":"pserver", - "url":"services/inventory/v8/pserver/1130672", - "properties":{ - "ptnii-equip-name":"e-name", - "equip-type":"server", - "hostname":"myhost", - "equip-vendor":"HP", - "equip-model":"DL380p-nd", - "fqdn":myhost.onap.net", - "purpose":"my-purpose", - "resource-version":"1477013499", - "ipv4-oam-address":"1.2.3.4" - } - } - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Get Vertex - - URL: https://<host>:9520/services/inventory/v8/pserver/<id> - Method: GET - Success Response: - Code: 200 - Content: - { - "id":"1130672", - "type":"pserver", - "url":"services/inventory/v8/pserver/<id>", - "properties":{ - "ptnii-equip-name":"e-name", - "equip-type":"server", - "hostname":"myhost", - "equip-vendor":"HP", - "equip-model":"DL380p-nd", - "fqdn":myhost.onap.net", - "purpose":"my-purpose", - "resource-version":"1477013499", - "ipv4-oam-address":"1.2.3.4" - }, - "in":[ - ], - "out":[ - { - "id":"1crwnu-6hc-d6vp-oe08g", - "type":"has", - "target":"services/inventory/v8/vserver/40964272", - "url":"services/inventory/relationships/v8/has/1crwnu-6hc-d6vp-oe08g" - } - ] - } - Error Response: - Code: 404 (NOT FOUND) - Situation: Resource Not found - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Get Vertices - - URL: https://<host>:9520/services/inventory/v8/pserver/ - Optional Query Param: ?equip-vendor=HP - Method: GET - Success Response: - Code: 200 - Content: - [ - { - "id":"950296", - "type":"pserver", - "url":"services/inventory/v8/pserver/950296" - }, - { - "id":"1126576", - "type":"pserver", - "url":"services/inventory/v8/pserver/1126576" - }, - { - "id":"1032384", - "type":"pserver", - "url":"services/inventory/v8/pserver/1032384" - } - ] - Error Response: - Code: 404 (NOT FOUND) - Situation: Resource Not found - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Update Vertex - -The PUT command is used to modify an existing vertex. By default, the vertex data is replaced by the content of the payload. However, teh following parameter can be added to the header to perform a PATCH instead of a replace: -**X-HTTP-Method-Override=Patch** - - URL: https://<host>:9520/services/inventory/v8/pserver/<id> - Method: PUT - Body: Same as POST - Success Response: - Code: 201 - Content: Same as POST - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Patch Vertex - - URL: https://<host>:9520/services/inventory/v8/pserver/<id> - Method: PATCH (Content-Type header set to application/merge-patch+json) - Body: - { - "properties":{ - "ptnii-equip-name":"e-name", - "resource-version":"1477013499", - "ipv4-oam-address":"1.2.3.99" - } - } - Success Response: - Code: 200 - Content: Same as POST - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - - ### Delete Vertex - - URL: https://<host>:9520/services/inventory/v8/pserver/<id> - Method: DELETE - Success Response: - Code: 200 - Error Response: - Code: 404 (NOT FOUND) - Situation: Resource not found - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Create Edge - -When creating an edge, the CRUD service will validate: -* properties match the defined schema -* relationship is valid between the source and target - - URL: https://<host>:9520/services/inventory/relationships/v8/runsOnPserver/ - Method: POST - Body: - { - "source":"services/inventory/v8/vserver/0", - "target":"services/inventory/v8/pserver/7", - "properties":{ - "multiplicity":"many", - "is-parent":true, - "uses-resource":"true", - "has-del-target":"true" - } - } - Success Response: - Code: 201 - Content: - { - "id":"215x5m-6hc-d6vp-oe08g", - "type":"runsOnPserver", - "url":"services/inventory/relationships/v8/has/215x5m-6hc-d6vp-oe08g", - "source":"services/inventory/v8/vserver/0", - "target":"services/inventory/v8/pserver/7", - "properties":{ - "is-parent":"true", - "multiplicity":"many", - "has-del-target":"true", - "uses-resource":"true" - } - } - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -Optionally, an edge can be created by posting to an endpoint which doesn't include the edge type. - - URL: https://<host>:9520/services/inventory/relationships/v8/ - Method: POST - Body: - { - "type":"runsOnPserver", - "source":"services/inventory/v8/vserver/0", - "target":"services/inventory/v8/pserver/7", - "properties":{ - "multiplicity":"many", - "is-parent":true, - "uses-resource":"true", - "has-del-target":"true" - } - } - Success Response: - Code: 201 - Content: Same as above - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Create Edge With Auto-Population Of Edge Properties -An alternate endpoint exists for creating edges which follows all of the conventions of the above endpoints, with the addition that properties defined in the db edge rules produced by the A&AI will be automatically populated for the edge. - - URL: https://<host>:9520/services/resources/relationships/runsOnPserver/ - Method: POST - Body: - { - "source":"services/inventory/v8/vserver/0", - "target":"services/inventory/v8/pserver/7", - "properties":{ - - } - } - Success Response: - Code: 201 - Content: - { - "id":"215x5m-6hc-d6vp-oe08g", - "type":"runsOnPserver", - "url":"services/inventory/relationships/v8/has/215x5m-6hc-d6vp-oe08g", - "source":"services/inventory/v8/vserver/0", - "target":"services/inventory/v8/pserver/7", - "properties":{ - "contains-other-v": "NONE", - "delete-other-v": "NONE", - "SVC-INFRA": "OUT", - "prevent-delete": "IN" - } - } - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -The same option to POST to an endpoint without specifying a type in the URL exists for this endpoint as well: - - URL: https://<host>:9520/services/resources/relationships/ - Method: POST - Body: - { - "type":"runsOnPserver", - "source":"services/inventory/v8/vserver/0", - "target":"services/inventory/v8/pserver/7", - "properties":{ - "multiplicity":"many", - "is-parent":true, - "uses-resource":"true", - "has-del-target":"true" - } - } - Success Response: - Code: 201 - Content: Same as above - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Get Edge - - URL: https://<host>:9520/services/inventory/relationships/v8/runsOnPserver/<id> - Method: GET - Success Response: - Code: 200 - Content: - { - "id":"215x5m-6hc-d6vp-oe08g", - "type":"runsOnPserver", - "url":"services/inventory/relationships/v8/has/215x5m-6hc-d6vp-oe08g", - "source":"services/inventory/v8/vserver/8400", - "target":"services/inventory/v8/pserver/40964272", - "properties":{ - "is-parent":"true", - "multiplicity":"many", - "has-del-target":"true", - "uses-resource":"true" - } - } - Error Response: - Code: 404 (NOT FOUND) - Situation: Resource Not found - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Get Edges - - URL: https://<host>:9520/services/inventory/relationships/v8/runsOnPserver - Optional Query Param: ?multiplicity=many - Method: GET - Success Response: - Code: 200 - Content: - [ - { - "id":"1crwnu-6hc-d6vp-oe08g", - "type":"runsOnPserver", - "url":"services/inventory/relationships/v8/runsOnPserver/1crwnu-6hc-d6vp-oe08g", - "source":"services/inventory/v8/vserver/8400", - "target":"services/inventory/v8/pserver/40964272" - }, - { - "id":"215x5m-6hc-d6vp-oe08g", - "type":"runsOnPserver", - "url":"services/inventory/relationships/v8/runsOnPserver/215x5m-6hc-d6vp-oe08g", - "source":"services/inventory/v8/vserver/8400", - "target":"services/inventory/v8/pserver/40964272" - } - ] - Error Response: - Code: 404 (NOT FOUND) - Situation: Resource Not found - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Update Edge - -The PUT command is used to modify an existing edge. By default, the edge data is replaced by the content of the payload. However, the following parameter can be added to the header to perform a PATCH instead of a replace: -**X-HTTP-Method-Override=Patch** - - URL: https://<host>:9520/services/inventory/relationships/v8/runsOnPserver/<id> - Method: PUT - Body: (**Note that the source and target can not be modified) - { - "properties":{ - "multiplicity":"many", - "is-parent":true, - "uses-resource":"true", - "has-del-target":"true" - } - } - Success Response: - Code: 200 - Content: Same as POST - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Patch Edge - - URL: https://<host>:9520/services/inventory/relationships/v8/runsOnPserver/<id> - Method: PATCH (Content-Type header set to application/merge-patch+json) - Body: - { - "properties":{ - "multiplicity":"many" - } - } - Success Response: - Code: 200 - Content: Same as POST - Error Response: - Code: 400 (BAD REQUEST) - Content: Error message describing the bad request failure. - Situation: Invalid Payload or schema error. - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. - -### Delete Edge - - URL: https://<host>:9520/services/inventory/relationships/v8/runsOnPserver/<id> - Method: DELETE - Success Response: - Code: 200 - Error Response: - Code: 404 (NOT FOUND) - Situation: Resource not found - - Code: 403 (FORBIDDEN) - Content: Error message describing the Authorization failure. - Situation: Authorization failure. - - Code: 415 (UNSUPPORTED MEDIA TYPE) - Situation: Unsupported content type . - - Code: 500 (Internal Server Error) - Content: Error message describing the failure. - Situation: Any scenario not covered by the above error codes. -
\ No newline at end of file diff --git a/VERTEX.md b/VERTEX.md new file mode 100644 index 0000000..603d748 --- /dev/null +++ b/VERTEX.md @@ -0,0 +1,280 @@ +## Vertex APIs + +### Create Vertex + +Vertex payload data is validated against oxm. +* Mandatory attributes are required in payload +* Data type validation is enforced +* Defaults from oxm schema used when not specified in payload + + URL: https://<host>:9520/services/inventory/v11/pserver/ + Method: POST + Body: + { + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + } + } + Success Response: + Code: 201 + Content: + { + "id":"1130672", + "type":"pserver", + "url":"services/inventory/v11/pserver/1130672", + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + } + } + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +Optionally, a vertex can be created by posting to an endpoint which doesn't include the vertex type. + + URL: https://<host>:9520/services/inventory/v11/ + Method: POST + Body: + { + "type":"pserver", + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + } + } + Success Response: + Code: 201 + Content: + { + "id":"1130672", + "type":"pserver", + "url":"services/inventory/v11/pserver/1130672", + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + } + } + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Get Vertex + + URL: https://<host>:9520/services/inventory/v11/pserver/<id> + Method: GET + Success Response: + Code: 200 + Content: + { + "id":"1130672", + "type":"pserver", + "url":"services/inventory/v11/pserver/<id>", + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + }, + "in":[ + ], + "out":[ + { + "id":"1crwnu-6hc-d6vp-oe08g", + "type":"has", + "target":"services/inventory/v11/vserver/40964272", + "url":"services/inventory/relationships/v11/has/1crwnu-6hc-d6vp-oe08g" + } + ] + } + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource Not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Get Vertices + + URL: https://<host>:9520/services/inventory/v11/pserver/ + Optional Query Param: ?equip-vendor=HP + Method: GET + Success Response: + Code: 200 + Content: + [ + { + "id":"950296", + "type":"pserver", + "url":"services/inventory/v11/pserver/950296" + }, + { + "id":"1126576", + "type":"pserver", + "url":"services/inventory/v11/pserver/1126576" + }, + { + "id":"1032384", + "type":"pserver", + "url":"services/inventory/v11/pserver/1032384" + } + ] + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource Not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Update Vertex + +The PUT command is used to modify an existing vertex. By default, the vertex data is replaced by the content of the payload. However, teh following parameter can be added to the header to perform a PATCH instead of a replace: +**X-HTTP-Method-Override=Patch** + + URL: https://<host>:9520/services/inventory/v11/pserver/<id> + Method: PUT + Body: Same as POST + Success Response: + Code: 201 + Content: Same as POST + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Patch Vertex + + URL: https://<host>:9520/services/inventory/v11/pserver/<id> + Method: PATCH (Content-Type header set to application/merge-patch+json) + Body: + { + "properties":{ + "ptnii-equip-name":"e-name", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.99" + } + } + Success Response: + Code: 200 + Content: Same as POST + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + + ### Delete Vertex + + URL: https://<host>:9520/services/inventory/v11/pserver/<id> + Method: DELETE + Success Response: + Code: 200 + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. |