{"id":20588835,"url":"https://github.com/ciscodevnet/ydk-py-samples","last_synced_at":"2025-08-30T15:09:19.932Z","repository":{"id":41548656,"uuid":"53708547","full_name":"CiscoDevNet/ydk-py-samples","owner":"CiscoDevNet","description":"Sample apps for YDK-Py","archived":false,"fork":false,"pushed_at":"2019-08-06T01:21:55.000Z","size":1500,"stargazers_count":97,"open_issues_count":32,"forks_count":87,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-08-30T10:43:31.398Z","etag":null,"topics":["cisco-ios-xr","openconfig","python","yang","ydk","ydk-py"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CiscoDevNet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-12T02:07:07.000Z","updated_at":"2025-06-27T19:14:57.000Z","dependencies_parsed_at":"2022-09-16T17:11:02.933Z","dependency_job_id":null,"html_url":"https://github.com/CiscoDevNet/ydk-py-samples","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/CiscoDevNet/ydk-py-samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-py-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-py-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-py-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-py-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CiscoDevNet","download_url":"https://codeload.github.com/CiscoDevNet/ydk-py-samples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-py-samples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272865146,"owners_count":25006134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cisco-ios-xr","openconfig","python","yang","ydk","ydk-py"],"created_at":"2024-11-16T07:26:42.459Z","updated_at":"2025-08-30T15:09:19.897Z","avatar_url":"https://github.com/CiscoDevNet.png","language":"Python","readme":"# Sample Apps for YDK-Py\nThis repository provides a collection of sample applications that use [YDK-Py](https://github.com/CiscoDevNet/ydk-py) for network programmability.  YDK-Py is the Python package for the Cisco YANG development kit (YDK) which provides model-driven APIs generated from a variety of YANG models.  \n\n## A \"hello, world\" App\nThe [hello-ydk.py](hello-ydk.py) script illustrates a minimalistic app that prints the uptime of a device running Cisco IOS XR.  The script opens a NETCONF session to a device with address 10.0.0.1, reads the system time and prints the formatted uptime.\n\n```python\n# import providers, services and models\nfrom ydk.services import CRUDService\nfrom ydk.providers import NetconfServiceProvider\nfrom ydk.models.cisco_ios_xr import Cisco_IOS_XR_shellutil_oper \\\n    as xr_shellutil_oper\nfrom datetime import timedelta\n\n\nif __name__ == \"__main__\":\n    \"\"\"Main execution path\"\"\"\n\n    # create NETCONF session\n    provider = NetconfServiceProvider(address=\"10.0.0.1\",\n                                      port=830,\n                                      username=\"admin\",\n                                      password=\"admin\",\n                                      protocol=\"ssh\")\n    # create CRUD service\n    crud = CRUDService()\n\n    # create system time object\n    system_time = xr_shellutil_oper.SystemTime()\n\n    # read system time from device\n    system_time = crud.read(provider, system_time)\n\n    # print system uptime\n    print(\"System uptime is \" +\n          str(timedelta(seconds=system_time.uptime.uptime)))\n\n    exit()\n```\n\nSample output\n```\n$ ./hello-ydk.py\nSystem uptime is 5 days, 3:52:08\n$\n```\n\n## Sample App Library\nThis repository includes a large number of [basic sample apps](samples/basic). They focus on a single model and have no or minimal programming logic (conditionals, loops, etc).  They should be your starting point if you don't have strong experience with models or programming.  They are grouped by service and model.\n\n## Installation\nThe sample apps do not require any special installation.  You can [download](https://github.com/CiscoDevNet/ydk-py/archive/master.zip) the entire repository as a compressed file or you can clone it:\n```\n$ git clone https://github.com/CiscoDevNet/ydk-py-samples.git\n```\n\n## Running an App\nInstructions for running the basic apps can be found in their [README](samples/basic/README.md) file.  Before you attempt to run any app, verify that your system supports Python 2.7 / 3.4 (or later):\n```\n$ python --version\nPython 2.7.6\n$\n$ python3 --version\nPython 3.5.2\n$\n```\n\nYour system must also have YDK-Py installed, including the respective model bundle (e.g. Cisco IOS XR, Cisco IOS XE, OpenConfig or IETF):\n```\n$ pip list | grep ydk\nydk                     0.6.0        \nydk-models-cisco-ios-xe 16.6.1       \nydk-models-cisco-ios-xr 6.2.2        \nydk-models-ietf         0.1.3        \nydk-models-openconfig   0.1.3        \n$\n```\n\nIf you don't have YDK-Py installed, verify [your system requirements](https://github.com/CiscoDevNet/ydk-py#system-requirements) and then follow the [YDK-Py installation instructions](https://github.com/CiscoDevNet/ydk-py#quick-install).\n\nThe [release versions of this repository](https://github.com/CiscoDevNet/ydk-py-samples/releases) match the [release versions of YDK-Py](https://github.com/CiscoDevNet/ydk-py/releases) used to test the sample apps.  Note that using a different YDK-Py version may break some of the sample apps.  For Cisco IOS XR models, you will need a device running at least Cisco IOS XR 6.0.0.  For Cisco IOS XE models, you will need a Cisco IOS XE device running at least 16.5.1.  \n\n## Vagrant Sandbox\nYou can instantiate a YDK-Py sandbox on your computer using Vagrant.  The sandbox will provide an Ubuntu VM with YDK-Py pre-installed.  Make sure you have these prerequisites installed on your computer:\n* [Virtualbox](https://www.virtualbox.org/wiki/Downloads)\n* [Vagrant](https://www.vagrantup.com/downloads.html)\n* An ssh client\n* ssh keys generated on your system\n\nTo create a sandbox, issue the following command from the directory where the `Vagrantfile` resides:\n```\n$ vagrant up\n```\n\nTo verify the status of your sandbox use:\n```\n$ vagrant status\n```\n\nOnce your sandbox is running, you can connect to it using:\n```\n$ vagrant ssh\n```\n\nNote that the `samples` and `projects` directories are shared between your host and your Vagrant box.  Any changes to those directories are seen in both environments.  Any other data in your Vagrant box is isolated from your host and will be lost if you destroy your Vagrant box.\n\nYou can suspend and resume your sandbox using:\n```\n$ vagrant suspend\n$ vagrant resume\n```\n\nTo destroy your sandbox, issue the following command:\n```\n$ vagrant destroy\n```\n\nIf you previously instantiated a YDK-Py sandbox, you can check for updates using:\n```\n$ vagrant box outdated\n```\n\nIf a newer version is available, you can update your sandbox automatically using:\n```\n$ vagrant box update\n```\n\n## Documentation and Support\nRead the [API documentation](http://ydk.cisco.com/py/docs/) for details on how to use the API and specific models.  For support, join the [YDK community](https://communities.cisco.com/community/developer/ydk) to connect with other users and with the makers of YDK\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fydk-py-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciscodevnet%2Fydk-py-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fydk-py-samples/lists"}