Cisco Blogs
Share

Simplifying Network Programmability with Model-Driven APIs

- February 6, 2017 - 0 Comments

We previously discussed how data models have become a key component of network programmability and the role they play in cloud-scale networking. Data models provide a clear representation of the capabilities of a networking device with a definition that is structured, well defined and computer friendly. But, how can a programmer use models to control a networking device?

The process can be a little bit involved. A client application and a network device need to agree on a protocol, encoding, transport and data structures. Traditionally, programmers require a set of libraries for the specific combination of protocol, encoding and transport that they intent to use. Furthermore, the application needs to be able to generate and handle configuration and operational data, plus actions, in compliance with the model implemented by the network device. As it should be obvious, there are several pieces to figure out before an automation application can take advantage of data models.

We have created the YANG Development Kit (YDK) to address the challenges of network programmability using data models. YDK can generate APIs in a variety of programming languages using YANG models. These APIs can then be used to simplify the implementation of applications for network automation. But how do these APIs really make your file easier?

  • Model driven.  You have no need to learn new data abstractions or hierarchies. YDK mirrors the structure of your data models. If you become familiar with the structure of a particular model, you will feel right at home using the API for that model. No need to handle YANG files directly.
  • Built-in data validation. YDK takes care of data validation, so you do not have to. Data models not only define a data hierarchy, but also specify the constrains associated with the data (e.g. type, valid values, ranges, etc). YDK services automatically perform thorough data validation (i.e. types, values, semmantics, deviations, etc). That validation takes place locally before your data is exchanged with the network device.
  • Protocol, transport and encoding support. You are not required to code the specifics of a management protocol (e.g. NETCONF RPCs) or manipulate encoded data directly (e.g. XML or JSON). A set of predefined services take care of the management protocol, the transport for your management session and the encoding and decoding of your data. Your automation code can focus on the details of the data exchanged with the device and the automation logic.

We open sourced YDK last year to help the industry reap the benefits of data models and facilitate the implementation of network automation. We welcome contributions and suggestions. You can expect an increasing number of models, services and providers, plus support for more programming languages in future releases. We have published APIs for Cisco IOS XR, OpenConfig and IETF data models. You can find the Python APIs in the YDK-Py repository and C++ APIs in the YDK-Cpp repository. In addition, we have made available hundreds of examples in the ydk-py-samples and ydk-cpp-samples repositories.

You can find additional details and documentation in the YDK site and join the discussion on the YDK community. For additional information on programmability, you can visit our model-driven programmability site.

Let’s automate!

Tags:

In an effort to keep conversations fresh, Cisco Blogs closes comments after 60 days. Please visit the Cisco Blogs hub page for the latest content.

Share