YANG Development Kit Model-driven APIs for simplified programmability of your network device
What is YDK?
We have created the YANG Development Kit (YDK) to facilitate 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. YDK has two main components: an API generator (YDK-gen) and a set of generated APIs. Today, YDK-gen takes YANG models as input and produces Python APIs (YDK-Py) that mirror the structure of the models.
Why YDK?
Any Model
Wide support for YANG data models (open or native)
Any Transport
Support for NETCONF and RESTCONF while extensible to other protocols
Any Language
Support for Python and C++ APIs while extensible to other programming languages
Open
APIs and their generator distributed as open source
A YDK Hello World!
from ydk.services import CRUDService
from ydk.providers import NetconfServiceProvider
from ydk.models.cisco_ios_xr import Cisco_IOS_XR_shellutil_oper \
as xr_shellutil_oper
from datetime import timedelta
if __name__ == "__main__":
"""Main execution path"""
provider = NetconfServiceProvider(address="10.0.0.1",
port=830,
username="admin",
password="admin",
protocol="ssh")
crud = CRUDService()
system_time = xr_shellutil_oper.SystemTime()
system_time = crud.read(provider, system_time)
print("System uptime is " +
str(timedelta(seconds=system_time.uptime.uptime)))
provider.close()
exit()