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

Yang enum default constraint

sudarkodi07
Level 1
Level 1

Hi,

I am trying to write the klish xml to handle enum in a yang like below,

leaf lb_type {
type enumeration {
enum L4 ;
enum L7 ;
}
default "L4";
description " Loadbalancer type for the loadbalancer service ";
}

my CLI configuration are working without the default "L4", but if I give default "L4" then some response from RESTCONF is showing some error like below,
return self.status_code >= 200 and self.status_code <= 299
TypeError: '>=' not supported between instances of 'NoneType' and 'int'

I was unable to send curl also when default "L4" is present in yang. Else everything is working fine. May I know what is issue here and could you please provide me the solution.

2 Replies 2

Just guessing here, if you use the mandatory attribute in the YANG model does that ensure that the lb_type leaf is always configured?

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

snovello
Cisco Employee
Cisco Employee
That looks like a python exception where you passed a null value into a comparison, the log file for the relevant package will have the stack trace and you might get a better clue as to what exactly is happening. The comparison is to an int, so may not be immediately related to the enum at all.

My guess based on what you shared so far is that what you try from RESTCONF API is not exactly equivalent to what you try in CLI.