Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

#Use caseScenarioDB (Spring) Response SPI ResponseJava APIREST API Response CodeResponse BodyError Object Message
1Add dataspacedataspace already existsDataIntegrityViolationExceptionDataspaceAlreadyDefinedExceptionDataspaceAlreadyDefinedException400 (bad request)json error objectdataspace xyz already defined
2Add schema set to dataspace

schema set with same name already exists

DataIntegrityViolationException

SchemaSetAlreadyDefinedException

SchemaSetAlreadyDefinedException400 (bad request)json error objectschema set xyz already defined for dataspace abc
3Add schema set to dataspacedataspacename does not existNo records (Optional, not present)DataspaceNotFoundExceptionDataspaceNotFoundException400 (bad request)json error objectTBD
4Add schema set to dataspace

the schema set throws a validation exception when parsed with ODL Yang Parser e.g.

  • No files (in zip)
  • Missing (import) files 
  • Incorrect yang in a module
  • Duplicate namespaces
N/AN/A

ModelValidationException (e casue)

details should contain cause message

400 (bad request)json error object

message and details from the original exception.

5List anchors for dataspace namedataspacename does not existNo records (Optional, not present)

DataspaceNotFoundException

DataspaceNotFoundException

400 (bad request)

json error objectdataspace xyz not found
6List anchors for dataspace nameno anchor records in DB0 recordsempty collectionempty collection200 (ok)

empty list


N/A
7Add a fragmentInsert a fragment that violates the unique constraint e.g. when trying to insert a fragment with the same property values(dataspace_id,anchor_id,xpath) as an existing fragment. DataIntegrityViolationException




8Remove schema setSchema set removal is requested from REST (or via API/SPI with explicitly defined option prohibiting removal of associated anchors and data if found) and there is (are) associated anchor record(s) in database.N/ASchemaSetInUseExceptionSchemaSetInUseException409 (Conflict)json error objectschama set abc in dataspace xyz is having anchor records associated.
9Get a fragment that does not existget fragment by xpath that does not existFragmentNotFoundExceptionDataNodeNotFoundExceptionDataNodeNotFoundException400 (bad request)json error objectdatanode with xpath xyz not found in dataspace xyz
10Invalid cps path

a cpsPath that cannot be parsed i.e. not recognized as a valid query

  • 2021-03-08T14:57:19.343Z|main|| o.onap.cps.rest.exceptions.CpsRestExceptionHandler - An error has occurred : Invalid cps path. Status: 400 BAD_REQUEST Details: Cannot interpret or parse cps path.
  • 2021-03-08 15:01:44.441 ERROR 21676 --- [ main] o.o.c.r.e.CpsRestExceptionHandler : An error has occurred : Unsupported leaf value. Status: 400 BAD_REQUEST Details: Unsupported leaf value in cps path.
CpsPathExceptionCpsPathExceptionCpsPathException400 (bad request)json error objectmessage and details from the original exception.
11Data node already existsCreate the same data node twice
DataIntegrityViolationException
DataNodeAlreadyDefinedDataNodeAlreadyDefined409 (Conflict)json error objectData node already defined for dataspace abc
12Unsupported update node leaves

Unsupported json data when 

  1. Conversion of a normalized node to a datanode within the datanode builder class.
private DataNode buildFromNormalizedNodeTree() {
final Collection<DataNode> dataNodeCollection = buildCollectionFromNormalizedNodeTree();
return dataNodeCollection.iterator().next(); }

2. Parsing list json data

  1. NoSuchElementException
  2. IllegalStateException
DataValidationException
DataValidationException
400json error object
"Unsupported json data: " + jsonData
13Delete dataspace with anchor/s

Delete dataspace that still contains 1 or more anchor


DataspaceInUseException

DataspaceInUseException

409

(Conflict)

json error object

dataspace contains anchor(s)

14Delete dataspace with schemaset/sDelete dataspace that still contains 1 or more schemaset
DataspaceInUseExceptionDataspaceInUseException

409

(Conflict)

json error objectdataspace contains schemaset(s)

Spike CPS-728: Inventory of HTTP Response Codes for all CPS interfaces

Jira
serverONAP Jira
serverId425b2b0a-557c-3c0c-b515-579789cceedb
keyCPS-782

CPS-Core

(commit id 8c9b4a24b4841154a2d08f506e2f7beca4f6fc31)

#Sub interfaceMethodScenarioSpecified HTTP Response CodeImplemented HTTP Response CodeComments
1Admin

POST - /v1/dataspaces

Create a new dataspace

201

400

401

403



2AdminDELETE - /v1/dataspacesDelete a dataspace

204

400

401

403

409



3AdminGET - /v1/dataspaces/{dataspace-name}/anchorsRead all anchors, given a dataspace

200

400

401

403

404



4AdminPOST - /v1/dataspaces/{dataspace-name}/anchorsCreate a new anchor in the given dataspace

201

400

401

403



5AdminGET - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}Read an anchor given an anchor name and a dataspace

200

400

401

403

404



6AdminDELETE - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}Delete an anchor given an anchor name and a dataspace

204

400

401

403



7AdminPOST - /v1/dataspaces/{dataspace-name}/schema-setsCreate a new schema set in the given dataspace

201

400

401

403



8AdminGET - /v1/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}Read a schema set given a schema set name and a dataspace

200

400

401

403

404



9AdminDELETE - /v1/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}Delete a schema set given a schema set name and a dataspace

204

400

401

403

409



10DataGET - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodeGet a node with an option to retrieve all the children for a given anchor and dataspace

200

400

401

403

404



11DataPUT - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodesReplace a node with descendants for a given dataspace, anchor and a parent node xpath

200

400

401

403



12DataPOST - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodesCreate a node for a given anchor and dataspace

201

400

401

403



13DataDELETE - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodesDelete a datanode for a given dataspace and anchor given a node xpath.

204

400

401

403



14DataPATCH - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodesUpdate a data node leaves for a given dataspace and anchor and a parent node xpath

200

400

401

403



15DataPUT - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodesReplace list content under a given parent, anchor and dataspace

200

400

401

403



16DataPOST - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodesAdd list element(s) to a list for a given anchor and dataspace

201

400

401

403



17DataDELETE - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes

Deprecated

Delete one or all list element(s) for a given anchor and dataspace

204

400

401

403



18QueryGET - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/queryQuery data nodes for the given dataspace and anchor using CPS path

200

400

401

403

404




CPS-NCMP

#Sub interfaceMethodScenarioSpecified HTTP Response CodeImplemented HTTP Response CodeCommentsBody
1Data

HTTP: GET - /v1/ch/{cm-handle}/data/ds/ncmp-datastore:passthrough-operational

NetworkCmProxyApi.getResourceDataOperationalForCmHandle()

Get resource data from pass-through operational for given cm handle

200

400

401

403

404

200

500



2Data

GET - /v1/ch/{cm-handle}/data/ds/ncmp-datastore:passthrough-running

NetworkCmProxyApi.getResourceDataRunningForCmHandle()

Get resource data from pass-through running for given cm handle

200

400

401

403

404

200

500



3Data

PUT- /v1/ch/{cm-handle}/data/ds/ncmp-datastore:passthrough-running

NetworkCmProxyApi.updateResourceDataRunningForCmHandle()

Update resource data from pass-through running for the given cm handle

200

400

401

403

404

200

500



4Data

POST - /v1/ch/{cm-handle}/data/ds/ncmp-datastore:passthrough-running

NetworkCmProxyApi.createResourceDataRunningForCmHandle()

Create resource data from pass-through running for given cm handle

201

400

401

403

404

201

500



5Data

PATCH - /v1/ch/{cm-handle}/data/ds/ncmp-datastore:passthrough-running

NetworkCmProxyApi.patchResourceDataRunningForCmHandle()

Patch resource data from pass-through running for the given cm handle

200

400

401

403

404

200

500



6Model

GET - /v1/ch/{cm-handle}/modules

NetworkCmProxyApi.getModuleReferencesByCmHandle

Fetch all module references (name and revision) for a given cm handle

200

400

401

403

404

200

500



7Model

POST - /v1/ch/searches

NetworkCmProxyApi.executeCmHandleSearch

Execute cm handle searches using 'hasAllModules' condition to get all cm handles for the given module names

200

400

401

403

200

500



8Inventory

POST /v1/ch

NetworkCmProxyInventoryApi.updateDmiPluginRegistration()

Register, update or remove cm handles

201

400

401

403

201

500

Implementation:

  • Invalid requests should return 4xx with an explanation message instead of 500 without information (ex: Invalid combination of plugin service names, URI is not absolute, ...)

...

#Sub interfaceMethodScenarioSpecified HTTP Response CodeImplemented HTTP Response CodeComments
1Query

GET - /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/history

CpsTemporalQueryApi.getAnchorDataByName()

Get anchor data by name

200

400

401

403

200 (ok)

  • for success

400 (bad request)

  • for input data validation errors

500 (internal server error)

  • for unexpected system errors


2Query

GET - /v1/dataspaces/{dataspace-name}/anchors/history

CpsTemporalQueryApi.getAnchorsDataByFilter()


Get anchors data based on filter criteria

200

400

401

403

200 (ok)

  • for success

400 (bad request)

  • for input data validation errors

500 (internal server error)

  • for unexpected system errors


General comments for

...

all endpoints

  • Always ensure that client request related errors return 4xx along with a clear explanation provided to the client about the reason for the error. When 4xx errors occur, the system itself is behaving as expected.
  • 500 response codes should only correspond to unexpected errors that require support investigation and effort in order to be fixed (ex: network communication issue, dependent component or system down, corrupted data, application bug, ...). For 500 errors no details are really expected in the response for the client, all the information to investigate the problem should be available in the logs.
  • Review 401 and 403 responses code from specification that are not implemented yet.
  • 500 needs to be added to the specification for all endpoints

...