ietf-netmod-yang

how to convert YANG data model to JSON data?

强颜欢笑 提交于 2019-12-07 18:03:00
问题 How do I convert "YANG" data model to "JSON"? As there is many many docs available in web, in that they changed in YANG synatx to JSON but how the value for the leaf or leaf list they are getting? from where and how it will get actual data in JSON from YANG? 回答1: Convert yang to xml using pyang -f yin filename Convert xml file to json using any of the solutions below https://stackoverflow.com/a/10201397/3283069 https://stackoverflow.com/a/6465496/3283069 回答2: Yang is a modeling language, not

understand YANG and its goals

独自空忆成欢 提交于 2019-12-06 10:30:39
I've read https://en.wikipedia.org/wiki/YANG but still having problems to understand the practical use of YANG , and the benefits it provides. As I understand, it now is used not only by NETCONF, as was originally designed. YANG is not a language in a common sense, as C or python for instance, i.e. whatever we write in YANG is not compiled or translated; as I understand is is used as a reference model for a higher level library or application. Then the question is how does the high level code understand YANG ? predi YANG is a specialized schema language, akin to XSD Schema or RelaxNG but (was)

how to convert YANG data model to JSON data?

柔情痞子 提交于 2019-12-06 03:39:54
How do I convert "YANG" data model to "JSON"? As there is many many docs available in web, in that they changed in YANG synatx to JSON but how the value for the leaf or leaf list they are getting? from where and how it will get actual data in JSON from YANG? user3283069 Convert yang to xml using pyang -f yin filename Convert xml file to json using any of the solutions below https://stackoverflow.com/a/10201397/3283069 https://stackoverflow.com/a/6465496/3283069 Yang is a modeling language, not a data generation language. What you are asking for is a simulator that will contain the same or

Yang action vs rpc and anydata vs anyxml

亡梦爱人 提交于 2019-12-02 05:34:39
问题 I could not understand the exact difference between Yang action vs Yang rpc and as well the difference between anydata vs anyxml. Why someone should model using anydata or anyxml? I tried finding more information about this, but I could not find. Any information on this is very helpful. 回答1: "rpc" vs. "action" The difference between an "rpc" and an "action" is that the latter is attached to a specific data node. This node may serve as metadata for the operation to be performed. The difference

usage of current vs ../ in yang xpath expressions

送分小仙女□ 提交于 2019-12-02 03:51:42
is the usage of .. and current() in the following snippet correct ? Meaning, there are times when current() and ../ are equivalent ? container c { leaf f1 { type string; } leaf f2 { type string; when "../f1 = 'abc'"; } leaf f3 { type string; when "current()/../f1 = 'abc'"; } } The way you use current() in your example is correct, but redundant. current() returns the initial context node and since all expressions start with the initial context node in their contexts in makes no sense to explicitly state this. This does not mean that current() is equivalent to ../ at the beginning of an

Yang action vs rpc and anydata vs anyxml

丶灬走出姿态 提交于 2019-12-01 23:29:24
I could not understand the exact difference between Yang action vs Yang rpc and as well the difference between anydata vs anyxml. Why someone should model using anydata or anyxml? I tried finding more information about this, but I could not find. Any information on this is very helpful. "rpc" vs. "action" The difference between an "rpc" and an "action" is that the latter is attached to a specific data node. This node may serve as metadata for the operation to be performed. The difference between an action and an rpc is that an action is tied to a node in the datastore, whereas an rpc is not.

Conditional assignment of default values in yang

社会主义新天地 提交于 2019-12-01 21:19:14
I have two properties in a model: leaf protocol, leaf port. I want to specify that: if protocol = 'ssh' then default port value is 22, if protocol = 'http' then default port value is 80, etc. How do I express this in yang ? There are no conditional default values in YANG - you need two default statements for two defaults with different values, and a single leaf may only have one default substatement. You can work around this, however. Perhaps by using a presence container instead of your protocol leaf : module conditional-default { namespace "http://example.com/conditional-default"; prefix