简体   繁体   English

有没有一种方法可以从yang文件中生成样本数据

[英]Is there a way to generate sample data out of a yang file

Our projects are based on yang modelling. 我们的项目基于yang建模。 there is a project which internally works on the modeled data of other projects. 有一个项目在内部处理其他项目的建模数据。

So, to start with that project, we need to populate the models of other projects with the data in the data stores. 因此,从该项目开始,我们需要用数据存储中的数据填充其他项目的模型。 this triggers the requirement of generating the sample data from a model 这触发了从模型生成样本数据的需求

looking for the sample data preferable in XML/JSON format 寻找XML / JSON格式的样本数据

Thanks Vikram 谢谢维克拉姆

Here are some ideas: 1. Get a tool like yang browser from MG-Soft. 这里有一些想法:1.从MG-Soft获得类似yang浏览器的工具。 OR 2. Try downloading confd-basic (free from Tail-f/Cisco). 或者2.尝试下载confd-basic(从Tail-f / Cisco免费下载)。 Compile a project using your yang modules (use a sample project from their distro and add to it). 使用yang模块编译项目(使用其发行版中的示例项目并添加到其中)。 Use the CLI and/or default values in the model to populate the database. 使用模型中的CLI和/或默认值填充数据库。 Then export the database either using show [running-config] |display [json|xml]. 然后使用show [running-config] | display [json | xml]导出数据库。 Or use netconf-console (also open-source) to perform a netconf "get-config" of the datastore and the result is xML. 或使用netconf-console(也是开源的)对数据存储执行netconf“ get-config”,结果是xML。

Either approach will involve some learning curve & time investment but you'll get some long-term recurring benefits. 每种方法都将涉及一些学习曲线和时间投入,但是您将获得一些长期的经常性收益。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM