cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
35
Views
0
Helpful
2
Replies
Cisco Employee

Yang enum fields as action inputs

 

Hi,

 

 

This might be a quite basic question, so sorry about this…

 

 

I have an action defined in yang with one of the input fields of type enumeration.

 

 

I want to invoke this action from Java code.

 

Currently, the only way I know to do it is to “guess” the numeric value assigned to each enum and provide the input as ConfEnumeration object.

 

Something like this:

 

 

ConfXMLParam[] params = new ConfXMLParam[] { new ConfXMLParamValue("xyz", "action", new ConfEnumeration(0)) };

 

myCont.action("my-action").call(params);

 

 

Do I have an alternative here?

 

How can I use the enum as it is defined in the yang model – the string representation, rather than this magic number (0 in this case)?

 

 

Thanks,

 

Yftach

 

Everyone's tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

Re: Yang enum fields as action inputs

 

Hi Yftach,

 

 

Perhaps this can help:

 

  1. ConfEnumeration.getEnumByLabel(path, label)

 

 

Thanks,

Bilal.

 

View solution in original post

2 REPLIES 2
Highlighted
Cisco Employee

Re: Yang enum fields as action inputs

 

Hi Yftach,

 

 

Perhaps this can help:

 

  1. ConfEnumeration.getEnumByLabel(path, label)

 

 

Thanks,

Bilal.

 

View solution in original post

Highlighted
Cisco Employee

Re: Yang enum fields as action inputs

 

Cool. I think this is exactly what I was looking for.

 

 

Thank you Bilal!

 

 

Regards,

 

Yftach

 

Content for Community-Ad
FusionCharts will render here