01-07-2020 04:50 AM - edited 01-07-2020 04:52 AM
Hello team,
How could I get the enum-value in my python part.
for exemple I have the Yang portion in my package :
leaf my-enum{ type enumeration { enum single{value 1;} enum dual{value 2;} } }
And in my python part I'd to get the value 1 or 2 instead of single or dual.
regards.
01-07-2020 05:00 AM
In [14]: my_enum
Out[14]: Enum string="interface " value="1"
In [15]: my_enum.value
Out[15]: 1
In [16]: my_enum.string
Out[16]: 'interface\xa0'
01-07-2020 06:21 AM
Hello I have tried this in my template file and it work fine. thx for your support.
<enum_val>{number(enum-value(/my_enum))}</enum_val>
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide