Subject: Re: [netconf] POST + Restconf 8040

From: "Reshad Rahman (rrahman)" <[email-masked]>
Date: Sun, 15 Mar 2020 22:21:05 +0000

If the resource doesn’t exist, the operation should succeed. If the resource already exists, it fails. What does a GET return?

https://tools.ietf.org/html/rfc8040#section-4.4.1

Regards,
Reshad.

From: netconf <[email-masked]> on behalf of "Xavier Pruno, Pratibha (Nokia - IN/Bangalore)" <[email-masked]>
Date: Sunday, March 15, 2020 at 6:01 AM
To: "[email-masked]" <[email-masked]>
Subject: [netconf] POST + Restconf 8040

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"
      }
    ]
  }
}
“

---

From: "Xavier Pruno, Pratibha (Nokia - IN/Bangalore)" <[email-masked]>
Date: Mon, 16 Mar 2020 03:57:10 +0000

1.  GET on “/restconf/data/Cisco-IOS-XE-native:native/logging” returned status: 204No Content
  2.  POST on “/restconf/data/Cisco-IOS-XE-native:native” returned status: 409Conflict

                     {
"logging": {
"monitor": {
"severity": "alerts"
}

                                }

}

  1.  PATCH on “/restconf/data/Cisco-IOS-XE-native:native” returned status: Content

{

  "native": {

    "logging": {

      "monitor": {

        "severity": "alerts"

      }

    }

  }

}

  1.  Again GET on “/restconf/data/Cisco-IOS-XE-native:native/loggingv” returned status” 200OK

{

  "Cisco-IOS-XE-native:logging": {

    "monitor": {

      "severity": "alerts"

    }

  }

}

When I read rfc 8040, there is no special mention on structural containers. So I assume the POST request in step #2 is valid.

Let me know if I am missing something.

Thanks,
Pratibha
From: "Reshad Rahman (rrahman)" <[email-masked]>
Date: Monday, 16 March 2020 at 3:51 AM
To: "Xavier Pruno, Pratibha (Nokia - IN/Bangalore)" <[email-masked]>, Netconf <[email-masked]>
Subject: Re: [netconf] POST + Restconf 8040

Regards,
Reshad.

Hi All,

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:

      "monitor": {

        "severity": "critical"

      }

    }

  }'

---

From: "Reshad Rahman (rrahman)" <[email-masked]>
Date: Wed, 18 Mar 2020 02:53:57 +0000

You’re doing a POST on “/restconf/data/Cisco-IOS-XE-native:native” (had missed that initially), since that resource already exists then what you’re seeing is expected. Try to do POST on “/restconf/data/Cisco-IOS-XE-native:native/logging”.

Regards,
Reshad.

From: "Xavier Pruno, Pratibha (Nokia - IN/Bangalore)" <[email-masked]>
Date: Sunday, March 15, 2020 at 11:57 PM
To: "Reshad Rahman (rrahman)" <[email-masked]>, "[email-masked]" <[email-masked]>
Subject: Re: [netconf] POST + Restconf 8040

                     {
"logging": {
"monitor": {
"severity": "alerts"
}

                                }

}

{

  "native": {

    "logging": {

      "monitor": {

        "severity": "alerts"

      }

    }

  }

}

{

    "monitor": {

      "severity": "alerts"

    }

  }

}

Thanks,
Pratibha

Regards,
Reshad.

Hi All,

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:

      "monitor": {

        "severity": "critical"

      }

    }

  }'