05-23-2019 03:41 AM - edited 05-23-2019 03:43 AM
Hi All
i want to deploy a Yang file on NSO service with following schema
- IF DeviceA are IOS TYPE, then 1 container;
I tried with the following pattern
when "/ncs:devices/ncs:device[ncs:name=current()/../deviceA]/ncs:platform/ncs:name = 'ios'";
but when I launch the make command, i've this logs
[nso@itminso src]$ make
/home/nso/NSO-4.3.6/bin/ncsc `ls OPM-IF-ann.yang > /dev/null 2>&1 && echo "-a OPM-IF-ann.yang"` \
-c -o ../load-dir/OPM-IF.fxs yang/OPM-IF.yang
yang/OPM-IF.yang:15: error: module 'tailf-ned-cisco-ios' not found
yang/OPM-IF.yang:19: error: module 'tailf-ned-cisco-ios-xr' not found
yang/OPM-IF.yang:53: error: the node 'deviceA' from module 'OPM-IF' (in node 'services' from 'tailf-ncs') is not found
yang/OPM-IF.yang:56: error: the node 'interface' from module 'tailf-ned-cisco-ios' (in node 'config' from 'tailf-ncs') is not found
Any Idea?
Thanks for all support
Maurizio
import tailf-ned-cisco-ios { prefix ios; } import tailf-ned-cisco-ios-xr { prefix cisco-iosxr; } augment /ncs:services { list OPM-IF { key name; uses ncs:service-data; ncs:servicepoint "OPM-IF"; leaf name { type string; } // Scelta del Device. leaf deviceA { type leafref { path "/ncs:devices/ncs:device/ncs:name"; } } leaf vlan-id { tailf:info "VLAN ID"; mandatory true; type int32 { range "2 .. 4094" { error-message "Invalid value for VLAN ID"; } } } // Sezione Interfaccia choice interfaceA { case ios { when "/ncs:devices/ncs:device[ncs:name=current()/../deviceA]/ncs:platform/ncs:name = 'ios'"; // /devices/device[name='IOS-CO']/platform/name ios leaf Giga_ios { type leafref { path "/ncs:devices/ncs:device[ncs:name=current()/../deviceA]/ncs:config/ios:interface/ios:GigabitEthernet/ios:name"; } } } case ios-xr { when "/ncs:devices/ncs:device[ncs:name=current()/../deviceA]/ncs:platform/ncs:name = 'ios-xr'"; leaf Giga_xr { type leafref { path "/ncs:devices/ncs:device[ncs:name=current()/../deviceA]/ncs:config/cisco-iosxr:interface/cisco-iosxr:GigabitEthernet/cisco-iosxr:id"; } } } } }
05-23-2019 06:43 AM
There are two issues here. The first one is in the Makefile (which you are not showing). You need to add to the YANGPATH so that the compiler can find the modules you are importing. In a standard NSO example Makefile, you can add at the top (for each NED you are importing):
YANGPATH += ../../<ned-name>/src/ncsc-out/modules
The other problem is that the when expression path to deviceA is incorrect. You need to remove ../ after your call to current. I know this may not be completely intuitive, but choice and case don't count as data nodes (do a get-config and see for yourself).
when "/ncs:devices/ncs:device[ncs:name=current()/deviceA]/ncs:platform/ncs:name = 'ios'";
05-23-2019 07:34 AM
Hi Jan
thanks for your replay.
I corrected makefile and yang file, please see the attached rar files for check.
My neds folder are showed in the following screen schot
When i re-try make command, following error
[nso@itminso src]$ make /home/nso/NSO-4.3.6/bin/ncsc `ls OPM-IF-ann.yang > /dev/null 2>&1 && echo "-a OPM-IF-ann.yang"` \ --yangpath ../../cisco-ios/src/ncsc-out/modules/yang --yangpath ../../cisco-ios-xr/src/yang -c -o ../load-dir/OPM-IF.fxs yang/OPM-IF.yang ../../cisco-ios/src/ncsc-out/modules/yang/tailf-ned-cisco-ios.yang:114976: warning: when tailf:cli-drop-node-name is given, it is recommended that tailf:cli-suppress-mode is used in combination. using tailf:cli-drop-nodename in a list child without using tailf:cli-suppress-mode on the list, might lead to confusing behaviour, where the user enters the submode without being able to give further configuration. ../../cisco-ios/src/ncsc-out/modules/yang/tailf-ned-cisco-ios.yang:124245: warning: when tailf:cli-drop-node-name is given, it is recommended that tailf:cli-suppress-mode is used in combination. using tailf:cli-drop-nodename in a list child without using tailf:cli-suppress-mode on the list, might lead to confusing behaviour, where the user enters the submode without being able to give further configuration. yang/OPM-IF.yang:19: error: module 'tailf-ned-cisco-iosxr' not found yang/OPM-IF.yang:65: error: the node 'interface' from module 'tailf-ned-cisco-iosxr' (in node 'config' from 'tailf-ncs') is not found make: *** [../load-dir/OPM-IF.fxs] Error 1 [nso@itminso src]$
Do you any idea?
Thanks a lot
Maurizio
05-29-2019 06:13 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide