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

(devices) POST returns 500 on data already exists

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • 7.0.0, 5.0.10, 6.0.6
    • 5.0.7, 4.0.8, 6.0.1
    • restconf-nb

      Successfully create a resource of your choice on device using POST request. Then invoke the same request again, for example:

      POST 

      http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount
      {
        "toaster:toaster": {
          "toasterManufacturer": "pantheon",
          "toasterModelNumber": 25,
          "toasterStatus": "up",
          "darknessFactor": 1000
        }
      } 

      We get the error response (500 Internal Server Error):

      <html><head>
          <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
          <title>Error 500 Internal Server Error</title>
      </head><body>
          <h2>HTTP ERROR 500 Internal Server Error</h2>
          <table>
              <tr>
                  <th>URI:</th>
                  <td>/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount
                  </td>
              </tr>
              <tr>
                  <th>STATUS:</th>
                  <td>500</td>
              </tr>
              <tr>
                  <th>MESSAGE:</th>
                  <td>Internal Server Error</td>
              </tr>
              <tr>
                  <th>SERVLET:</th>
                  <td>org.glassfish.jersey.servlet.ServletContainer</td>
              </tr>
          </table></body></html>

      According to RFC 8040 we should get 409 Conflict. Something similar to:

      <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
          <error>
              <error-type>protocol</error-type>
              <error-tag>data-exists</error-tag>
              <error-path
              xmlns:rc="urn:ietf:params:xml:ns:yang:ietf-restconf"
              xmlns:jbox="https://example.com/ns/example-jukebox">\
              /rc:restconf/rc:data/jbox:jukebox
              </error-path>
              <error-message>
              Data already exists; cannot create new resource
              </error-message>
          </error>
      </errors>

            yaroslav.lastivka Yaroslav Lastivka
            ivanhrasko Ivan Hrasko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: