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.
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!
# import providers, services and models 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"""# create NETCONF session
provider = NetconfServiceProvider(address="10.0.0.1",
port=830,
username="admin",
password="admin",
protocol="ssh")
# create CRUD service
crud = CRUDService()
# create system time object
system_time = xr_shellutil_oper.SystemTime()
# read system time from device
system_time = crud.read(provider, system_time)
# Print system timeprint("System uptime is "+str(timedelta(seconds=system_time.uptime.uptime)))
# close NETCONFIG session and exit
provider.close()
exit()