Subject: [netconf] POST + Restconf 8040

From: "Xavier Pruno, Pratibha (Nokia - IN/Bangalore)" <[email-masked]>
Date: Sun, 15 Mar 2020 10:00:12 +0000

Hi All,

  Is the below  one a valid restconf POST request for the below yang?  But a patch request goes through fine. Please note logging monitor is not enabled when the post request is sent. Is this expected in the case of “structural containers” ?

Assume the yang is :

  Cisco-IOS-XE-native.yang

    container native {
           container logging {
                container monitor {
                     presence “true”;
                      leaf severity {
                         type logging-level-type
                       }
                   }
              }
       }

Restconf POST Request:

curl --location --request POST 'https://10.10.20.48:443/restconf/data/Cisco-IOS-XE-native:native' \
--header 'Accept: application/yang-data+json' \
--header 'Content-Type: application/yang-data+json' \
--header 'Authorization: Basic ZGV2ZWxvcGVyOkMxc2NvMTIzNDU=' \
--data-raw '
{
   "logging": {

      "monitor": {

        "severity": "critical"

      }

    }

  }'

The above request fails with the error:

I am getting the error “{
  "errors": {
    "error": [
      {
        "error-message": "object already exists: /ios:native/ios:logging",
        "error-path": "/Cisco-IOS-XE-native:native",
        "error-tag": "data-exists",
        "error-type": "application"
      }
    ]
  }
}
“