cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Cisco Community Designated VIP Class of 2020

219
Views
15
Helpful
2
Replies
Cisco Employee

Use pyang to validate backward incompatibility for augmented statement

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
Cisco Employee

Re: Use pyang to validate backward incompatibility for augmented statement

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

 

Cisco Employee

Re: Use pyang to validate backward incompatibility for augmented statement

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