Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-776

min-elements and max-elements are not enforced

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • 1.2.2, 1.1.3, 2.0.4
    • 2.0.5
    • None
    • None
    • Operating System: All
      Platform: All

    • 8496

    Description

      Just tried carbon archetype with this model:

      module archcarbon {
          yang-version 1;
          namespace "urn:opendaylight:params:xml:ns:yang:archcarbon";
          prefix "archcarbon";
      
          revision "2015-01-05" {
              description "Initial revision of archcarbon model";
          }
      
          container box {
      
              list object {
                  key object-id;
      
                  leaf object-id {
                      type string;
                  }
      
                  leaf-list attributes {
                      type string;
                      min-elements 1;
                      max-elements 2;
                  }
      
              }
      
          }
      
      }
      

      Then tried PUT http://controller:8181/restconf/config/archcarbon:box/ with the bodies below:

      1) Skip attributes is not allowed -> OK

      {
        "box": {
          "object": [
            {
        	"object-id":1,
            }
          ]
        }
      }
      

      2) Less attributes than min-elements is allowed -> NOK

      {
        "box": {
          "object": [
            {
              "object-id":1,
        	   "attributes": []
            }
          ]
        }
      }
      

      3) More attributes than max-elements is allowed -> NOK

      {
        "box": {
        	"object": [
        	  {
        		"object-id":1,
        		"attributes": [
        		    "object1",
        		    "object2",
        		    "object3"
        	]
            }
          ]
        }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            ecelgp Luis Gomez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: