cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
911
Views
15
Helpful
2
Replies

Use pyang to validate backward incompatibility for augmented statement

pralala
Cisco Employee
Cisco Employee

Hello folks,

I have 2 revisions of same model which i want to compare for backward incompatibility.

augment "/ios:native/ios:interface/ios:TwentyFiveGigE/ios:ip" {
uses config-interface-ip-nbar-grouping;
}


In the first model i have the above, and in the 2nd model i removed the same statement.
How do i validate using pyang as the structure of ios:interface/ios:TwentyFiveGigE/ is defined in a different file and it seems pyang is not really considering the augmented statement when i remove it. 
I ran these 2 commands but it never showed me the expected output that TwentyFiveGigE is being removed

pyang --strict  --check-update-from ../16.12.1/Cisco-IOS-XE-nbar.yang Cisco-IOS-XE-nbar.yang --check-update-from-path ~/newncs/nso-5.2.1.1/src/ncs/yang/

pyang --strict --check-update-from ../16.12.1/*.yang *.yang --check-update-from-path ~/newncs/nso-5.2.1.1/src/ncs/yang/



There is a way to do using ncsc compiler though when i do a revision merge of fxs files, it gives me the expected output which is good, but i want a way without doing all the revision merge and determine before hand if there is any incompatibility
ncsc: Revision <<"2020-03-01">> deletes item /devices/device/config/native/interface/ATM/encapsulation/dot1Q/second-dot1q

 

Also, any other tool apart from pyang which could be useful like yanger,confdc etc please let me know. Just want a way to catch these things via script

2 Replies 2

gmuloche
Cisco Employee
Cisco Employee

Hello,

 

which version of pyang are you using? with 2.0.1 I manage to get the error:

 

cisco@server # pyang --strict --check-update-from ../16121/Cisco-IOS-XE-nbar.yang Cisco-IOS-XE-nbar.yang    
Cisco-IOS-XE-nbar.yang:1: error: new revision 2019-07-01 is not newer than old revision 2019-07-01 (RFC 6020: 10, p2)
Cisco-IOS-XE-nbar.yang:1: error: the augment '/ios:native/ios:interface/ios:TwentyFiveGigE/ios:ip', defined at ../16121/Cisco-IOS-XE-nbar.yang:1066 is illegally removed

[... truncated]

I have just done the following:

 

pyang --version # output pyang 2.0.1
git clone https://github.com/YangModels/yang cd yang/vendor/cisco/xe/ cp -r 16121 test cd test # edit by removing the same augment as you in the same file pyang --strict --check-update-from ../16121/Cisco-IOS-XE-nbar.yang Cisco-IOS-XE-nbar.yang

Note: the version that comes with NSO is pyang 1.5 which is much older and which should not be used I think - it indeed does not detect the augment on my laptop

cisco@server # pyang --strict --check-update-from ../16121/Cisco-IOS-XE-nbar.yang Cisco-IOS-XE-nbar.yang
Cisco-IOS-XE-nbar.yang:1: error: new revision 2019-07-01 is not newer than old revision 2019-07-01 (RFC 6020: 10, p2)

 

I looked at yanger but could not find similar option.

 

regards

 

Thank you so muchh for your help! This worked!

I installed pyang using pip3.7 install pyang



PRALALA-M-27BM:17.2.1 pratik$  /usr/local/bin/pyang   --strict --check-update-from  ../16.12.1/Cisco-IOS-XE-nbar.yang Cisco-IOS-XE-nbar.yang  -p /Users/pratik/confd/src/confd/yang/ -P /Users/pratik/confd/src/confd/yang/ 


/usr/local/bin/pyang   --strict --check-update-from  ../16.12.1/Cisco-IOS-XE-nbar.yang Cisco-IOS-XE-nbar.yang  -p /Users/pratik/newncs/ncs-5.2.1/src/ncs/yang/ -P /Users/pratik/newncs/ncs-5.2.1/src/ncs/yang/   --verbose

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 NSO Developer community: