cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
334
Views
0
Helpful
1
Replies

Is there any way to Set the values for the List items using SetLeaf

Raja.Selvaraj
Level 4
Level 4

I Wanted to set the values for the each items in the List entry .I knew there are many way to do that but for the current situation i should only use setLeaf .

Is it possible to set values using setLeaf to the List by iterating the List .Appreciate quick answer.

I wanted to Call setLeaf for the each of the list item below and that should update the value for "nnn-name" in each iteration.

[

    {

        "nnn-name": "RCBHY70029",

        "ip-version": "IPv4",

        "abc-address": "10.32.128.96",

        "xx-number": "65377"

    },

   {

        "nnn-name": "ABCCY70029",

        "ip-version": "IPv4",

        "abc-address": "10.32.128.56",

        "xx-number": "65379"

    },

    {

        "nnn-name": "ombdb65",

        "ip-version": "IPv6",

        "abc-address": "2001:8004:ff00:4000:0:7:e1c1:a8d3",

        "xx-number": "65380"

    }

]

1 Accepted Solution

Accepted Solutions

Jan Lindblad
Cisco Employee
Cisco Employee

Well, you didn't provide the YANG file for this data, so I can't tell for sure. I would guess the nnn-name is the key of the list. If so, you'd use create() to create list instances, then setElem() on each of the non-key leafs.


If on the other hand this is a config false keyless list, you could use setElem to set each leaf.

View solution in original post

1 Reply 1

Jan Lindblad
Cisco Employee
Cisco Employee

Well, you didn't provide the YANG file for this data, so I can't tell for sure. I would guess the nnn-name is the key of the list. If so, you'd use create() to create list instances, then setElem() on each of the non-key leafs.


If on the other hand this is a config false keyless list, you could use setElem to set each leaf.