cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
999
Views
0
Helpful
2
Replies

Expected result in Python of an exists() on an boolean leaf

lweddewer
Level 5
Level 5

Hello,

 

I want to use a leaf type boolean:

leaf active {
type boolean;
}

 

What is the expected result of the exists() function a leaf of type boolean?

 

I get a error message "'bool' object has no attribute 'exists'."

 

That's not what I expect! :(

 

Regards

Lothar

1 Accepted Solution

Accepted Solutions

tbjurman
Cisco Employee
Cisco Employee

Hi Lothar,

 

Reading a boolean leaf using maagic will return True or False (native Python type) if the leaf exists.

If it doesn't exist the return value will be None.

 

/Tomas

View solution in original post

2 Replies 2

tbjurman
Cisco Employee
Cisco Employee

Hi Lothar,

 

Reading a boolean leaf using maagic will return True or False (native Python type) if the leaf exists.

If it doesn't exist the return value will be None.

 

/Tomas

Hi Tomas,

thank you for your reply.
I was somewhat struggled because I changed a former implementation based on a empty leaf towards the a boolean because I needed the three stats "not set", "true" and "false".
Reading the Maagic API discription coming with nso I expeted to handle a boolean as a NonEmptyLeaf() Class object.


Regards Lothar