1

I'm not a professional network engineer and have poor experience with NETCONF. Could you please explain to me why standard requires two different files with different extensions (xml/json and yang) to configure a network device?

According to information that I've found on the internet YANG model is intended to set a "blueprint" of configuration. They say that yang is a good DSL for creating hierarchy. And configurational data itself located in xml/json configs. Why not use only XML-based config? XML is very good language for creating and maintaining hierarchy and contains essential data for configuring device.

1 Answer 1

0

I am not sure if you are asking the question correctly. It is usually either of xml/json is supported or sometimes BOTH of them. This depends on what device/OS you are using. For example: In Cisco ACI (which uses RESTCONF), you can use either xml or json formats. Same data can be represented in either XML or JSON.

YANG model defines the hierarchy that you can use (the relationship between objects, which parent, which child, what properties in each object...etc.). The data or config itself ( that is governed by the model defined by YANG) is represented in xml or json.

Not sure if I made it simple enough. I hope I did.

3
  • My question can be simplified the following way: why do we have YANG if a config file (json or xml) is present?
    – Nabla
    Commented Jun 25 at 9:37
  • Good question. YANG will tell you what you can configure what you can't. For example, on network devices, you can do speed command under physical interface probably, but you can't do it under vlan interface. This info you put in YANG format that physical interface object supports speed to be modified while vlan interface does not. Now, if you try to use REST/NETCONF to configure VLAN interface with speed command it will not find it available, but if you try speed command under physical interface it will work (because your YANG model defines speed for physical but not vlan interfaces). HTH Commented Jun 27 at 13:16
  • Thanks for example! As far as I understand, YANG defines constraints that cannot be defined on config (json/xml) level. The main responsibility of the config level is to provide concrete values or data for tweaks. YANG checks this data whether it is applicable on a certain device.
    – Nabla
    Commented Jul 1 at 10:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.