Skip to content

Holo Guide ‐ Importance of YANG

Paul-weqe edited this page Sep 4, 2024 · 3 revisions

According to RFC 7950, YANG(Yet Another Next Generation) is a data modelling language used to model configuration data, state data, Remote Procedure Calls and notifications for network management protocols. This basically means that it gives you the structure of how your data should look, the types it should have etc...you as the developer take this structure and build the RFCs, notifications and network management protocols on top of it.

This is a small snippet from the IETF YANG model of VRRP:

  grouping vrrp-global-state-attributes {
    description
      "Group of VRRP global state attributes.";

    leaf virtual-routers {
      type uint32;
      description
        "Number of configured virtual routers.";
    }

    leaf interfaces {
      type uint32;
      description
        "Number of interfaces with VRRP configured.";
    }
  }

This tells you that there is a group of attributes called vrrp global state. This group of attributes contains an item called virtual-routers, which is the number of virtual routers and interfaces which is the number of interfaces. This does not give us specific pieces of information, such as the name of an attribute etc...it just tells us the structure of how the attributes should look like.

Emphasis on structure

In the introduction, we mentioned our commitment to maintaining a very solid structure in holo. This is crucial, yet it can be challenging to achieve consistently. YANG models play a pivotal role in this effort by providing a structured blueprint that helps us define and describe the various protocols we implement. In holo, every networking protocol begins with a YANG model, ensuring that we clearly understand what we will be calling and how the data should be structured.

However, it's worth noting that YANG can become quite complex and confusing, especially when dealing with intricate protocols. Fortunately, we rarely need to write YANG models from scratch. Many popular networking protocols already have well-defined YANG models available (you can explore them here). This resource significantly eases the burden of YANG modeling and allows us to focus more on implementing and refining our protocols.

But, there is more...

Beyond the structured approach of the holo backend, YANG also plays a crucial role in organizing commands on the holo-cli. The holo-cli communicates with the backend using the gRPC protocol. Instead of manually inputting most commands, 99% of the commands available in holo-cli are generated dynamically. These commands are derived from a "capabilities" request sent to the backend, which returns a list detailing everything the backend (holod) can do. This list of capabilities is automatically generated from YANG models, which means that the holo-cli is also organized around YANG.

While there’s much more to explore about YANG—such as submodules, augmentations, and more—for now, it’s important to grasp how vital YANG is to the holo ecosystem, and indeed, to networking as a whole.

Next, let's setup our holo's dependencies and input our first YANG model.