10-18-2016 11:08 AM
The YDK-PY samples repository has gone through three important improvements to bring apps in line with the recent enhancements introduced in YDK 0.5.0 and later. These changes apply to all apps (~250) in the repository:
before:
nc-create-config-ipv4-bgp-10-ydk.py
nc-read-oper-clns-isis-10-ydk.py
nc-create-config-bgp-10-ydk.py
after:
nc-create-xr-ipv4-bgp-cfg-10-ydk.py
nc-read-xr-clns-isis-oper-10-ydk.py
nc-create-oc-bgp-10-ydk.py
Here are a couple of samples of how the import statement will look for XR and OpenConfig BGP models:
from ydk.models.<bundle> import <model> as <alias>
from ydk.models.cisco_ios_xr import Cisco_IOS_XR_ipv4_bgp_cfg as xr_ipv4_bgp_cfg
from ydk.models.openconfig import openconfig_bgp as oc_bgp
The directory structure has been enhanced to align closely with the model bundle packaging. Basic apps are still grouped by service, but under a service, the directory structure aligns with the model bundle packages. For the two BGP models referenced above, these are the paths in the repository where they reside:
$ tree samples/basic/crud/models/cisco-ios-xr/Cisco-IOS-XR-ipv4-bgp-cfg/
samples/basic/crud/models/cisco-ios-xr/Cisco-IOS-XR-ipv4-bgp-cfg/
├── nc-create-xr-ipv4-bgp-cfg-10-ydk.py
├── nc-create-xr-ipv4-bgp-cfg-40-ydk.py
├── nc-create-xr-ipv4-bgp-cfg-40-ydk.txt
├── nc-create-xr-ipv4-bgp-cfg-40-ydk.xml
├── nc-create-xr-ipv4-bgp-cfg-41-ydk.py
├── nc-create-xr-ipv4-bgp-cfg-41-ydk.txt
├── nc-create-xr-ipv4-bgp-cfg-41-ydk.xml
├── nc-create-xr-ipv4-bgp-cfg-42-ydk.py
├── nc-create-xr-ipv4-bgp-cfg-42-ydk.txt
├── nc-create-xr-ipv4-bgp-cfg-42-ydk.xml
├── nc-create-xr-ipv4-bgp-cfg-43-ydk.py
├── nc-create-xr-ipv4-bgp-cfg-43-ydk.txt
├── nc-create-xr-ipv4-bgp-cfg-43-ydk.xml
├── nc-create-xr-ipv4-bgp-cfg-44-ydk.py
├── nc-create-xr-ipv4-bgp-cfg-44-ydk.txt
├── nc-create-xr-ipv4-bgp-cfg-44-ydk.xml
├── nc-create-xr-ipv4-bgp-cfg-45-ydk.py
├── nc-create-xr-ipv4-bgp-cfg-45-ydk.txt
├── nc-create-xr-ipv4-bgp-cfg-45-ydk.xml
├── nc-delete-xr-ipv4-bgp-cfg-10-ydk.py
├── nc-delete-xr-ipv4-bgp-cfg-20-ydk.py
├── nc-read-xr-ipv4-bgp-cfg-10-ydk.py
└── nc-update-xr-ipv4-bgp-cfg-10-ydk.py
0 directories, 23 files
$
The entire directory structure for all basic apps currently looks like this:
$ tree samples/basic/crud/models/openconfig/openconfig-bgp/
samples/basic/crud/models/openconfig/openconfig-bgp/
├── nc-create-oc-bgp-10-ydk.py
├── nc-create-oc-bgp-40-ydk.py
├── nc-create-oc-bgp-40-ydk.txt
├── nc-create-oc-bgp-41-ydk.py
├── nc-create-oc-bgp-41-ydk.txt
├── nc-create-oc-bgp-42-ydk.py
├── nc-create-oc-bgp-42-ydk.txt
├── nc-create-oc-bgp-43-ydk.py
├── nc-create-oc-bgp-43-ydk.txt
├── nc-create-oc-bgp-44-ydk.py
├── nc-create-oc-bgp-44-ydk.txt
├── nc-create-oc-bgp-45-ydk.py
├── nc-create-oc-bgp-45-ydk.txt
├── nc-delete-oc-bgp-10-ydk.py
├── nc-delete-oc-bgp-20-ydk.py
├── nc-read-oc-bgp-10-ydk.py
└── nc-update-oc-bgp-10-ydk.py
0 directories, 17 files
$
samples/basic/
├── codec
│ └── models
│ ├── cisco-ios-xr
│ │ ├── Cisco-IOS-XR-cdp-cfg
│ │ ├── Cisco-IOS-XR-clns-isis-cfg
│ │ ├── Cisco-IOS-XR-crypto-macsec-mka-cfg
│ │ ├── Cisco-IOS-XR-ethernet-lldp-cfg
│ │ ├── Cisco-IOS-XR-ifmgr-cfg
│ │ ├── Cisco-IOS-XR-infra-infra-clock-linux-cfg
│ │ ├── Cisco-IOS-XR-infra-infra-locale-cfg
│ │ ├── Cisco-IOS-XR-ip-ntp-cfg
│ │ ├── Cisco-IOS-XR-ip-static-cfg
│ │ ├── Cisco-IOS-XR-ipv4-bgp-cfg
│ │ ├── Cisco-IOS-XR-man-ems-cfg
│ │ └── Cisco-IOS-XR-policy-repository-cfg
│ └── openconfig
│ └── openconfig-routing-policy
└── crud
└── models
├── cisco-ios-xr
│ ├── Cisco-IOS-XR-cdp-cfg
│ ├── Cisco-IOS-XR-clns-isis-cfg
│ ├── Cisco-IOS-XR-clns-isis-oper
│ ├── Cisco-IOS-XR-crypto-macsec-mka-cfg
│ ├── Cisco-IOS-XR-ethernet-lldp-cfg
│ ├── Cisco-IOS-XR-ifmgr-cfg
│ ├── Cisco-IOS-XR-infra-infra-clock-linux-cfg
│ ├── Cisco-IOS-XR-infra-infra-locale-cfg
│ ├── Cisco-IOS-XR-ip-ntp-cfg
│ ├── Cisco-IOS-XR-ip-ntp-oper
│ ├── Cisco-IOS-XR-ip-static-cfg
│ ├── Cisco-IOS-XR-ipv4-bgp-cfg
│ ├── Cisco-IOS-XR-lib-keychain-macsec-cfg
│ ├── Cisco-IOS-XR-linux-os-reboot-history-oper
│ ├── Cisco-IOS-XR-man-ems-cfg
│ ├── Cisco-IOS-XR-policy-repository-cfg
│ ├── Cisco-IOS-XR-shellutil-filesystem-oper
│ └── Cisco-IOS-XR-shellutil-oper
└── openconfig
├── openconfig-bgp
├── openconfig-mpls
└── openconfig-routing-policy
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: