Yangify is Released

Blog Detail

At Network to Code, we’re happy to announce that Yangify has been officially released and is the first project of many that’ll be released over the coming months that’ll be the foundation of the Rosetta RESTCONF API, the industry’s first open source model-driven HTTP-based API.

At its core, Yangify is a parsing and translation engine built for model-driven network automation using YANG as the de facto standards-based modeling language.

Here is a short description of each core function of Yangify:

  • Parsing: any configuration and operational commands (from devices) parsed will generate normalized JSON data that maps to the YANG model; we commonly refer to this data as Yangify’d JSON.
  • Translating: Any Yangify’d JSON (generated by users and automation systems) gets translated into the required CLI commands (or APIs) that need to get applied to the device.

YANG Models

YANG models are the foundation of what Yangify does. In order to use Yangify, you’ll need to have access to YANG models. These can be standards based models from groups like OpenConfig or IETF or custom models, as we alluded to in our last post. You’ll just need to document the location of your models so Yangify knows where to look for them. All of this can be seen in the tutorials found in the docs.

Yangify Parsing

The following visuals represent what parsing in Yangify is all about:

Yangify Translating

The following visuals represent what translating in Yangify is all about:

Why Yangify?

It’s quite simple. Yangify is a framework that brings structure and sanity for working with YANG based data. Yangify is actually built on top of yangson, so you could in theory do what Yangify is doing manually by only using yangson for model validation, but then no parser or translator would look alike or follow the same patterns. Our goal is to provide the framework, structure, and repository for all parsers and translators so we can work together as in industry to solve problems in a more efficient manner. Additionally, there is still the need in the industry to have more useful and usable YANG tools, and Yangify will play a part in growing the adoption of consuming YANG data models for network automation.

More on Yangify:

Yangify Docs: https://yangify.readthedocs.io/en/latest/

Yangify on GitHub: https://github.com/networktocode/yangify

Happy Automating!

Jason (@jedelman8)



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!

Open Source Model Driven Network Programmability

Blog Detail

Imagine being able to use a single API to communicate with any piece of network equipment regardless of vendor. Imagine if this API used standards-based YANG models and even permitted the use of custom YANG models. Imagine if this API was open source.

Within the next few months, you won’t have to imagine anymore. Network to Code has been working hard to make this a reality.

The Problem Statement

Before we look at the solution, let’s level-set the problem.

While many of the modern network operating systems (NOSs) offer APIs nowadays, many of them are unique per vendor, or worse, they are unique per platform. Of course, there are still even more legacy platforms in production without API support. Those devices offer SSH access to the device’s command line interface (CLI). In both of these use cases, the data returned from a command or API call is vendor-specific.

Note: While we know a few vendors have added support for vendor-neutral data models, they are few and far between, are often buggy, and often lack parity with other platforms and vendors.

If the data returned is vendor-specific, it means that to consume the data and streamline network automation activities, there needs to be some level of data normalization. The act of normalization needs to consider both text parsing for legacy devices and transforming already structured data such as JSON/XML into the normalized and desired-state structured data. Moreover, for a comprehensive solution that also includes configuration management, the normalization process needs to have ways to translate the normalized data back into the vendor’s native configuration (specific CLI commands or structured data).

The Solution

The easy response to this is that all vendors and devices should support the same models and APIs (and we agree!). However, it’ll be a while. The industry moves slowly. While progress is being made in the industry on routers and switches, consider different device types like firewalls and load balancers. There is still much work to be done here (more vendor support and demand from buyers is needed).

Network to Code to Open Source Model Driven Programmability API Framework

In order to mitigate the problem at hand and move the industry forward, Network to Code will be open sourcing four different projects creating a vendor-neutral and extensible RESTCONF API. This API will be able to talk to any device with any OS including legacy devices that only support SSH.

The four projects we’ll be releasing, in the order of which they’ll be released:

Yangify

Yangify is an engine that focuses on parsing and translating native configuration into JSON-encoded YANG data using native Python in contrast to a domain specific language (DSL). It takes native configuration from the likes of show commands and creates a structured and methodical approach to create JSON data that adheres to YANG models. It also translates YANGify’d JSON into the native configuration (CLI commands or native JSON/XML). For anyone that has been doing any text parsing on their journey already, Yangify is analogous to TextFSM, although Yangify parses and translates, not just parses.

Rosetta

Rosetta provides two core functions. First, the Rosetta project will store all Yangify parsers and translators. Second, it’ll provide an intuitive Python interface to consume all of the parsers and translators. Rosetta is analogous to ntc-templates with the TextFSM analogy.

NTC YANG Models

Standards-based YANG models are actually quite complex and nested and usually have a steep learning curve. These models need to account for nearly every use case a feature may have. In order to obtain the benefits model-driven APIs, but make them easier to consume and practical for most Enterprises, this project will contain a combination of stripped down standards-based YANG models and extremely simplified models focused on the core feature sets often found in Enterprise networks.

Rosetta RESTCONF API

The capstone to all of this is a lightweight RESTCONF API that brings together all of the aforementioned functionality, but also integrates southbound connectivity to network devices making this a complete multi-vendor API. The API will communicate with network devices while parsing and translating native configurations in real-time. The Rosetta RESTCONF API will also support candidate configurations and the ability to hook into other systems using the Python API, configurable and triggered on any incoming API call. In order to achieve device connectivity, NAPALM will be used within the Rosett RESTCONF API.

Bringing everything that will be open sourced and combining it with NAPALM, the following is a visual representation of what the full stack looks like for the Rosetta RESTCONF API.

The Rosetta RESTCONF API

yangify_rosetta_01

I’d also like to extend a huge thanks to David Barroso for the core development of these projects and helping make them a reality.

Interested to hear more? Feel free to reach out! Otherwise, come back next week to hear more about Yangify, when it gets released.

Happy Automating!

Jason



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!