cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
575
Views
5
Helpful
2
Replies

Module Error with pyang sample-xml-skeleton and IOS-XE YANG models

DrSchw0b
Beginner
Beginner

Hi,

I am new to YANG/Netconf. Apologies in advance if there is an obvious answer to my question.

I am using the Yang models of the https://github.com/YangModels/yang repositories, Python 3.9.2 and pyang 2.5.3 for the following:

I am trying to get a feeling for the YANG models in combination with Netconf. I came across pyang with the “sample-xml-skeleton” format. As a beginner this looks to me as approach to get the XML template, I might use to correctly format the Netconf payload. In fact, I succeed to do so with the IETF interfaces YANG model:

 

pyang -t edit -f sample-xml-skeleton yang/standard/ietf/RFC/ietf-interfaces.yang --sample-xml-skeleton-defaults

 

After that I tried to get a “template” for IOS-XE ntp servers:

 

$ pyang -f sample-xml-skeleton yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ntp.yang --sample-xml-skeleton-defaults
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ntp.yang:5: error: module "cisco-semver" not found in search path
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ntp.yang:11: error: module "Cisco-IOS-XE-types" not found in search path
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ntp.yang:14: error: module "Cisco-IOS-XE-native" not found in search path
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ntp.yang:17: error: module "Cisco-IOS-XE-interface-common" not found in search path
sample-xml-skeleton plugin needs a valid module

 

As you can see, I got an error message.

I also tried running the command in the respective YANG Model folder or by adding the path parameter to the command. Both generated the (more or less) same warning messages:

 

cd yang/vendor/cisco/xe/1781/
pyang -f sample-xml-skeleton Cisco-IOS-XE-ntp.yang --sample-xml-skeleton-defaults
[output omitted]

==============================
pyang -t edit -f sample-xml-skeleton -p yang/vendor/cisco/xe/1781/ yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ntp.yang --sample-xml-skeleton-defaults
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:636): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:1620): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:1623): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:1635): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:1782): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:1785): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:1962): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:2420): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:3944): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:4031): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:4155): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:4449): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:5556): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:5559): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:5572): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:5751): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:5754): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:5941): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2592 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-interfaces.yang:6310): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1615): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1790): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1793): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1796): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1799): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1802): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1805): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1808): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1811): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1814): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1817): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1820): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1823): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1826): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1829): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1832): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1835): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1838): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1876): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1879): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1882): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1885): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1888): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1891): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1894): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1897): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1900): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1903): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1906): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1909): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1912): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1915): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1918): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1921): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:1924): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:3232): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:3288): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2543 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ip.yang:3816): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2565 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ipv6.yang:503): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ipv6"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2565 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-ipv6.yang:527): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ipv6"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:235): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:244): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:673): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:728): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:860): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:922): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:1120): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:1135): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:1168): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
yang/vendor/cisco/xe/1781/Cisco-IOS-XE-native.yang:2862 (at yang/vendor/cisco/xe/1781/Cisco-IOS-XE-logging.yang:1183): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
<?xml version='1.0' encoding='UTF-8'?>
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"/>

 

I am now wondering whether there might be an issue with the IOS-XE 17.8.1 YANG models and how to proceed. Any support is very much appreciated. Thank you, a lot, in advance for your support.

1 Accepted Solution

Accepted Solutions

Thank you for pointing me into the right direction. I was able to get the required XML "template" with pyang using the following command:

pyang -f sample-xml-skeleton Cisco-IOS-XE-native.yang Cisco-IOS-XE-ntp.yang --sample-xml-skeleton-defaults --sample-xml-skeleton-path=/native/ntp

I learned that the file names of all required models must be passed to pyang for it to work. The "tree" output with a single model might work; however, this model might lack the surrounding element structure. For the NTP servers to be set, the "native" tags must surround the "ntp" element.

View solution in original post

2 Replies 2

miott
Cisco Employee
Cisco Employee

The ntp model augments the Cisco-IOS-XE-native model so looking directly at the ntp model will give you nothing.  I suggest you look at https://developer.cisco.com/yangsuite.  Yangsuite will gather together all the model dependencies and give you a visual tree structure to look at.  You can also interact with devices using various protocols like NETCONF, RESTCONF, and gNMI.

Thank you for pointing me into the right direction. I was able to get the required XML "template" with pyang using the following command:

pyang -f sample-xml-skeleton Cisco-IOS-XE-native.yang Cisco-IOS-XE-ntp.yang --sample-xml-skeleton-defaults --sample-xml-skeleton-path=/native/ntp

I learned that the file names of all required models must be passed to pyang for it to work. The "tree" output with a single model might work; however, this model might lack the surrounding element structure. For the NTP servers to be set, the "native" tags must surround the "ntp" element.

Getting Started

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: