Over the years, ConfD has demonstrated the power of the data model-driven paradigm. Having a formal description of the data provides a rock-solid foundation for automation. The most visible form of automation from a data model in ConfD is the auto-rendering of the various northbound management interfaces based on the YANG data model.
Additionally, we’ve seen the concrete value of needing to only write one common set of backend instrumentation code towards the YANG data model – model once, instrument once, use many. There are other less visible benefits to having a formal data model including model-to-model transforms and mapping. These transform and mapping techniques formed one of the bases on which Cisco Network Services Orchestrator (NSO) was designed: service model to device model mapping.
In the world of REST, Swagger (https://swagger.io) has become a popular set of tools for describing RESTful APIs. A Swagger definition file is written in either YAML or JSON format. Then, the Swagger tools are used to automate the generation of curl calls, API library generation, etc. from the definition file.
You’ll note some conceptual parallels between ConfD’s data model-driven paradigm and Swagger’s automation. Since ConfD includes support for RESTCONF which is defined by YANG data models, it was only natural for us to consider that there must be a way to generate Swagger definition files from YANG data models in order to help our customers to automate some of their RESTCONF activities. The resulting support for generating a Swagger definition file in JSON format was added to ConfD’s “yanger”
tool and released as part of ConfD 6.7.
To help you get your Swagger on, we wrote our latest application note, “RESTCONF, YANG, and Swagger” to provide an in-depth, hands-on look at this new feature in ConfD. Naturally, by generating a Client API in various programming language it opens new possibilities to develop RESTCONF based applications to interact with ConfD YANG data models. We think this application note will provide you with some new ideas and opportunities to leverage the Swagger tools.