cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
652
Views
2
Helpful
3
Replies

Validate YANG models against CLI arguments

haksson81
Level 1
Level 1

Hi,

We have a CLI-based app that leverages YANG models and I am supposed to test that, but i am clueless on where to start, I wonder if YDK can be used for that purpose.

This App is probably parsing YANG models under the hood and exposing variables in YANG as arguments on the CLI.

example: lets say the app is doing BGP YANG model as CLI arguments, where they will look like this:

./app.py -a bgp_neighbor -b bgp_source -c bgp_port -d remote_AS_number -e local_AS_number

I just want to make sure that all the arguments are there and nothing is missing, without having to read every single argument, so  i am basically looking for automating that task of comparing CLI arguments with YANG models.

Probably i need to write some code to validate that CLI will expose all the YANG variables in the model, we need to make sure that CLI is not missing any variables.

Do you think there are tools out there that can be stitched together with YDK to do something similar, without having to write code from scratch?

Thanks,

Hakan

3 Replies 3

einarnn
Cisco Employee
Cisco Employee

Hakan,

I don't think there's anything the YDK can help with here out of the box. It seems that the arguments you need to validate would completely depend on the YANG model, so have you thought about expressing those arguments in a way that allows you to map them to paths in the yang model you care about?

Without knowing bit more about what you are trying to achieve and how it relates to your potential target models, it's hard to conclude how the YDK may or may not be able to help you, or if some other solution is more appropriate.

Cheers,

Einar

saalvare
Cisco Employee
Cisco Employee

At first look, this sounds very questionable:

This App is probably parsing YANG models under the hood and exposing variables in YANG as arguments on the CLI.

example: lets say the app is doing BGP YANG model as CLI arguments, where they will look like this:

./app.py -a bgp_neighbor -b bgp_source -c bgp_port -d remote_AS_number -e local_AS_number

Nodes should really be specified by path instead of name.  A name can be used at different places in a model.  Also, the size of an average model will make a CLI-argument approach rather impractical.

Maybe if you describe the underlying problem that the app is trying to achieve, we could see if YDK can help.

I am a network guy, so its not easy to explain programmability things.

I gave that example (imaginary) to make my question simple, and of course, you are right, its a full path, something like :

./app.py create <CPENAME> pe <PENAME> network <NETWORKNAME> force

./app.py delete <CPENAME> pe <PENAME> network <NETWORKNAME> force

Once a create is used then all recursive arguments are populated from that yang model.

Now, in my case, say the latter argument called 'force' is already in the YANG model but it doesn't serve any purpose/function, which was a valid test case where we tried 'force' and it crashed the app., so i'm just trying to find a way to automatically generate test cases for checking these kind of issues, as these YANG models keep getting updated all the time.

Hope its clearer now.