Search code examples
protocol-buffersprotobuf-netietf-netmod-yang

YANG vs Protobuf


We are trying to model the configuration of a networking device. The model will be pretty much hierarchical. What are the pros and cons of writing the model in Yang vs Protobuf?


Solution

  • TL;DR: if you want to take advantage of real NW management standards then go with YANG and NETCONF/RESTCONF. If your use case is very specific and you want to progress faster then use Protocol Buffers.

    If your device is going be managed by a variety of network management tools it may be beneficial to use YANG for modeling and put a 3rd party NETCONF agent (like TailF ConfD) in the device. Your job would be "just" to define your model and integrate the device internals with the agent. YANG and NETCONF/RESTCONF are actual network management standards so your device will be compatible with many management tools that already support YANG and NETCONF. So, by choosing YANG, you may actually open up business opportunities for your device.

    You may choose, as predi suggested, to use YANG to create models and then develop an automatic way to convert these models to protobuf models. In that way you could take advantage of advanced YANG modeling and fast and compact communication at runtime using protobuf. That sounds like a very interesting idea for an open source project (and people already thought of that to some extent) but it requires quite a lot of effort and it would be hard to accomplish it without expertise in both technologies. Note that you'll never achieve the benefits of the first approach by mingling YANG and protobuf on your own because there will be no such standard in NW management world.

    If your focus is time and you just want to get coding, then I'd personally recommend using clean protobuf. This would make your solution simpler and you could take full advantage of the big protobuf community. Sure, YANG has advantages and it is closely related to real NW management protocols, but it is also complex and way less popular so you'd likely get lost within all its peculiarities.