Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behaviour of Empty LIST Input in RESTCONF JSON #166

Closed
navaneethyv opened this issue Dec 30, 2020 · 4 comments
Closed

Behaviour of Empty LIST Input in RESTCONF JSON #166

navaneethyv opened this issue Dec 30, 2020 · 4 comments
Labels

Comments

@navaneethyv
Copy link

navaneethyv commented Dec 30, 2020

Hi !

I have a question on the behaviour of LISTs with no data in them.

Consider the below yang schema

{
    .....
         container route {
                    list ipv4 {
                       key "prefix4";
                       leaf prefix4 {
                            type ipv4;
                      },
                      leaf safi {
                          type safi;
                      }
                   }
             }
    .....
 }

When an input via RESTCONF in JSON format is given as the following

{

                  <some config >

                    "route": {
                        "ipv4": []
                    },
                
                 <some more config >
                 
 }

The data is crafted in the way that none of the attributes inside the LIST ipv4 is given.

CLIXON responds back promptly with

{
"ietf-restconf:errors" : {
  "error": {
    "error-type": "application",
    "error-tag": "missing-element",
    "error-info": {
      "bad-element": "prefix4"
    },
    "error-severity": "error",
    "error-message": "Mandatory key"
  }
}

Complaining about the missing "prefix4".

The question is if the entire list is empty . shall that empty list be ignored without returning any errors by simply not processing that section and processing the rest of the valid data ?

@olofhagsand
Copy link
Member

olofhagsand commented Jan 13, 2021

This seems to be an error. Problem being json2xml translation that produces eg this:

      <route>
	<ipv4/>
      </route>

which is wrong: it expresses an (empty) ipv4 list element.

@olofhagsand
Copy link
Member

Changed json->xml translation of empty lists so that eg, {"route":{"ipv4":[]}} is translated to <route/>

@idefixcert
Copy link

Hey all,

thanx for this wonderful library.

In my opinion this issue was misunderstood, we face the same issue:
if we send to restconf:

"route": {
    "ipv4": []
},

we get an error:

{
"ietf-restconf:errors" : {
  "error": {
    "error-type": "application",
    "error-tag": "missing-element",
    "error-info": {
      "bad-element": "prefix4"
    },
    "error-severity": "error",
    "error-message": "Mandatory key"
  }
}

but sending

"route": {
},

is ok.

in essence should in my opinion a "ipv4": [] treated the same as not specifying it.

Regards

@olofhagsand
Copy link
Member

Thanks.
Do you want to re-open this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants