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:
- Basic apps now use a file name that is better aligned with data models names. Previous app names captured model type (config vs. operational state) and used a model name suffix. That approach did work well for models that define both config and operational state (e.g. OpenConfig), plus the model suffix was not descriptive enough in some cases. Instead, the new file name notation incorporates a briefly abbreviated model name. The abbreviated name provides an useful hint of what model bundle the application uses. Here are some of examples:
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
- Apps are now compatible with the model bundles introduced in YDK 0.5.0. The change to each app is minor, but important. It only impacts the path of the import statement associated with the data model used. The new style follows this structure:
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
$
$ 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
Comments
0 comments
Please sign in to leave a comment.