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

949
Views
10
Helpful
2
Replies
crench92
Beginner

NETCONF NED Make Error | YANG naming overlap

I’m running into issues where I can’t create a Docker image based on a NETCONF NED created using this method: https://developer.cisco.com/docs/nso/guides/#!netconf-ned-builder/overview-of-the-netconf-ned-builder-workflow

 

I fetch the modules, selected Cisco-IOS-XE-*, then ran make-development-ned as I need the netsim support.  When running make within src folder I get the same error as the attached docker build error.

 

It seems to be something related to the yang files but I'm not sure.  I don't think I should have to go into each YANG model from the device and notate it.

1 ACCEPTED SOLUTION

Accepted Solutions
cohult
Cisco Employee

It is of course a good option to create tailf annotation files and add a tailf:dependency extension to each of those must statements and a tailf:code-name extension for the conflicting bits/enums/nodes.

However, It is not mandatory to do so and it may not be necessary for your use-case to address those warnings. So you can, for now, ignore the warnings by in your development NED package src/Makefile remove the "--fail-on-warnings" flag.

BTW, NSO 5.5.2 does not seem to include the "--fail-on-warning" flag in the package created from the "make-development-ned" command. 

  • The tailf:dependency statement will help NSO to not evaluate must statements XPath expressions unnecessarily when the config is committed. 
  • The tailf:code-name extension will resolve conflicts for the autogenerated Java/Python namespace class that you may or may not need to use if you add Java/Python code.

If you want to address those warnings, you can create a YANG annotation modules like this one (my-yang-module-ann.yang that annotates a my-yang-module.yang):

module my-yang-module-ann {
  namespace "urn:my-yang-module-ann";
  prefix m-ann;
  import tailf-common {
    prefix tailf;
  }
  tailf:annotate-module " my-yang-module" 
    tailf:annotate-statement "grouping[name='my-grouping']" {
     tailf:annotate-statement "container[name='my-container']" 
        tailf:annotate-statement “leaf[name='some-leaf']" {
tailf:annotate-statement "must[condition='count(../some-list) > 0']" {
tailf:dependency "../some-list";
}         }       }     }   } }

With the development NED, just place the annotation module with the original yang module under src/yang

If you want to include the annotation file with the NED builder build, after downloading the YANG models before building the NED with the NED builder register the annotation module with the NSO NED builder by doing something like this:

$ cp /path/to/ my-yang-module-ann.yang /$MY_NSO_PROJECT/state/netconf-ned-builder/cache/$MY_NED_NAME-nc-1.0/
$ ncs_cmd -c 'mcreate "/netconf-ned-builder/project{/$MY_NED_NAME 1.0}/module{my-yang-module-ann 2021-mm-dd}"; mset "/netconf-ned-builder/project{$MY_NED_NAME 1.0}/module{my-yang-module-ann 2021-mm-dd}/namespace" "urn:my-yang-module-ann"; mset "/netconf-ned-builder/project{$MY_NED_NAME 1.0}/module{ my-yang-module-ann 2021-mm-dd}/location" "NETCONF"; mset "/netconf-ned-builder/project{$MY_NED_NAME 1.0}/module{my-yang-module-ann 2021-mm-dd}/status" "selected downloaded"'

 

View solution in original post

2 REPLIES 2
cohult
Cisco Employee

It is of course a good option to create tailf annotation files and add a tailf:dependency extension to each of those must statements and a tailf:code-name extension for the conflicting bits/enums/nodes.

However, It is not mandatory to do so and it may not be necessary for your use-case to address those warnings. So you can, for now, ignore the warnings by in your development NED package src/Makefile remove the "--fail-on-warnings" flag.

BTW, NSO 5.5.2 does not seem to include the "--fail-on-warning" flag in the package created from the "make-development-ned" command. 

  • The tailf:dependency statement will help NSO to not evaluate must statements XPath expressions unnecessarily when the config is committed. 
  • The tailf:code-name extension will resolve conflicts for the autogenerated Java/Python namespace class that you may or may not need to use if you add Java/Python code.

If you want to address those warnings, you can create a YANG annotation modules like this one (my-yang-module-ann.yang that annotates a my-yang-module.yang):

module my-yang-module-ann {
  namespace "urn:my-yang-module-ann";
  prefix m-ann;
  import tailf-common {
    prefix tailf;
  }
  tailf:annotate-module " my-yang-module" 
    tailf:annotate-statement "grouping[name='my-grouping']" {
     tailf:annotate-statement "container[name='my-container']" 
        tailf:annotate-statement “leaf[name='some-leaf']" {
tailf:annotate-statement "must[condition='count(../some-list) > 0']" {
tailf:dependency "../some-list";
}         }       }     }   } }

With the development NED, just place the annotation module with the original yang module under src/yang

If you want to include the annotation file with the NED builder build, after downloading the YANG models before building the NED with the NED builder register the annotation module with the NSO NED builder by doing something like this:

$ cp /path/to/ my-yang-module-ann.yang /$MY_NSO_PROJECT/state/netconf-ned-builder/cache/$MY_NED_NAME-nc-1.0/
$ ncs_cmd -c 'mcreate "/netconf-ned-builder/project{/$MY_NED_NAME 1.0}/module{my-yang-module-ann 2021-mm-dd}"; mset "/netconf-ned-builder/project{$MY_NED_NAME 1.0}/module{my-yang-module-ann 2021-mm-dd}/namespace" "urn:my-yang-module-ann"; mset "/netconf-ned-builder/project{$MY_NED_NAME 1.0}/module{ my-yang-module-ann 2021-mm-dd}/location" "NETCONF"; mset "/netconf-ned-builder/project{$MY_NED_NAME 1.0}/module{my-yang-module-ann 2021-mm-dd}/status" "selected downloaded"'

 

removing "--fail-on-warning" solved this issue.  Thanks a lot for the help.