Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-542

PUT request return 500 if operational data are used

XMLWordPrintable

      If we are sending operational data using PUT request on device via mountpoint we expect 400 bad-request but we receive 500 instead.

      Example request

      PATH:
      https://0.0.0.0:8888/restconf/data/network-topology:network-topology/topology=topology-netconf/node=Node2/yang-ext:mount/toaster:toaster

      BODY:

      {
          "toaster": {
              "darknessFactor": 200,
              "toasterModelNumber" : "asdfe"
          }
      }
      

      toasterModelNumber is nonConfig data so I expect 400 bad request answer but instead I receive

      {
          "ietf-restconf:errors": {
              "error": [
                  {
                      "error-message": "Transaction(PUT) not committed correctly",
                      "error-tag": "operation-failed",
                      "error-type": "application"
                  }
              ]
          }
      }
      

      This is caused by netconf sb

      AbstractWriteTx class resultsToTxStatus method always changes data to same exception

      new NetconfDocumentedException(id + ":RPC during tx failed",
                                              DocumentedException.ErrorType.APPLICATION,
                                              DocumentedException.ErrorTag.OPERATION_FAILED,
                                              DocumentedException.ErrorSeverity.ERROR);
      

      and restconf FutureCallbackTx in method addCallback it always changes to

      new RestconfDocumentedException("Transaction(" + txType + ") not committed correctly", e);
      

      or

      RpcResultBuilder.newError(RpcError.ErrorType.RPC, "operation-failed", e.getMessage())
      

      but we alway loose error type and error tag.

            Unassigned Unassigned
            JakubToth Jakub Toth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: