<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic bad keyref (14): illegal reference error in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/bad-keyref-14-illegal-reference-error/m-p/4272401#M6002</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to setup a cml cicd pipeline using this example from Joe Clark:&amp;nbsp;&lt;A href="https://github.com/CiscoDevNet/cml-cicd" target="_blank" rel="noopener"&gt;https://github.com/CiscoDevNet/cml-cicd&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have noticed that he created a vlan-service and a switch-topology service in NSO 5.4 so I have recompiled the service to regenerate the .fxs files on my NSO 5.3 changing the minimum version in the&amp;nbsp;&lt;EM&gt;package-meta-data.xml&lt;/EM&gt; file to 5.3&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then reload the &lt;EM&gt;ncs&lt;/EM&gt; service with the &lt;EM&gt;--with-package-reload&lt;/EM&gt; option and I see these services in the ncs_cli (see below) but when I try to run the populate_nso.py script to populate the NSO instance I receive this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;_ncs.error.Error: bad keyref (14): illegal reference /switch-topology:switch-topology{headquarters}/switch{sw-core}/downlink-trunk&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I see on the ncs_cli:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;admin@ncs# show packages package vlan-service 
packages package vlan-service
 package-version 1.0
 description     "Generated Python package"
 ncs-min-version [ 5.3 ]
 python-package vm-name vlan-service
 directory       ./state/packages-in-use/1/vlan-service
 templates       [ trunk-port-template vlan-service-template ]
 component main
  application python-class-name vlan_service.main.Main
  application start-phase phase2
 oper-status up&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;admin@ncs(config-switch-sw-core)# exit
admin@ncs(config-switch-topology-headquarters)# switch sw-core ?
Possible completions:
downlink-trunk uplink-trunk &amp;lt;cr&amp;gt;
admin@ncs(config-switch-topology-headquarters)# switch sw-core&lt;/PRE&gt;&lt;PRE&gt;admin@ncs(config)# show configuration 
switch-topology headquarters
 switch sw-core
  downlink-trunk [ 0/1 ]
 !
!&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to commit the changes directly through the ncs_cli&amp;nbsp; I receive a similar error:&lt;/P&gt;&lt;PRE&gt;admin@ncs(config)# commit
Aborted: illegal reference 'switch-topology headquarters switch sw-core downlink-trunk'&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The hq_topology file that the script uses to populate NSO is simple:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;topology: headquarters

devices:
  - name: sw-core
    address: 192.168.10.207
    ned_id: cisco-ios-cli-3.8:cisco-ios-cli-3.8
    os: ios
    downlink_trunks:
      - "0/1"
  - name: sw-dist
    address: 192.168.10.208
    ned_id: cisco-ios-cli-3.8:cisco-ios-cli-3.8
    os: ios
    uplink_trunk: "0/1"
    downlink_trunks:
      - "0/2"
  - name: sw-access
    address: 192.168.10.191
    ned_id: cisco-ios-cli-3.8:cisco-ios-cli-3.8
    os: ios
    uplink_trunk: "0/1"&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;Any suggestions/idea ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 14 Jan 2021 13:47:17 GMT</pubDate>
    <dc:creator>Stefano Pilla</dc:creator>
    <dc:date>2021-01-14T13:47:17Z</dc:date>
    <item>
      <title>bad keyref (14): illegal reference error</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/bad-keyref-14-illegal-reference-error/m-p/4272401#M6002</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to setup a cml cicd pipeline using this example from Joe Clark:&amp;nbsp;&lt;A href="https://github.com/CiscoDevNet/cml-cicd" target="_blank" rel="noopener"&gt;https://github.com/CiscoDevNet/cml-cicd&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have noticed that he created a vlan-service and a switch-topology service in NSO 5.4 so I have recompiled the service to regenerate the .fxs files on my NSO 5.3 changing the minimum version in the&amp;nbsp;&lt;EM&gt;package-meta-data.xml&lt;/EM&gt; file to 5.3&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then reload the &lt;EM&gt;ncs&lt;/EM&gt; service with the &lt;EM&gt;--with-package-reload&lt;/EM&gt; option and I see these services in the ncs_cli (see below) but when I try to run the populate_nso.py script to populate the NSO instance I receive this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;_ncs.error.Error: bad keyref (14): illegal reference /switch-topology:switch-topology{headquarters}/switch{sw-core}/downlink-trunk&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I see on the ncs_cli:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;admin@ncs# show packages package vlan-service 
packages package vlan-service
 package-version 1.0
 description     "Generated Python package"
 ncs-min-version [ 5.3 ]
 python-package vm-name vlan-service
 directory       ./state/packages-in-use/1/vlan-service
 templates       [ trunk-port-template vlan-service-template ]
 component main
  application python-class-name vlan_service.main.Main
  application start-phase phase2
 oper-status up&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;admin@ncs(config-switch-sw-core)# exit
admin@ncs(config-switch-topology-headquarters)# switch sw-core ?
Possible completions:
downlink-trunk uplink-trunk &amp;lt;cr&amp;gt;
admin@ncs(config-switch-topology-headquarters)# switch sw-core&lt;/PRE&gt;&lt;PRE&gt;admin@ncs(config)# show configuration 
switch-topology headquarters
 switch sw-core
  downlink-trunk [ 0/1 ]
 !
!&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to commit the changes directly through the ncs_cli&amp;nbsp; I receive a similar error:&lt;/P&gt;&lt;PRE&gt;admin@ncs(config)# commit
Aborted: illegal reference 'switch-topology headquarters switch sw-core downlink-trunk'&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The hq_topology file that the script uses to populate NSO is simple:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;topology: headquarters

devices:
  - name: sw-core
    address: 192.168.10.207
    ned_id: cisco-ios-cli-3.8:cisco-ios-cli-3.8
    os: ios
    downlink_trunks:
      - "0/1"
  - name: sw-dist
    address: 192.168.10.208
    ned_id: cisco-ios-cli-3.8:cisco-ios-cli-3.8
    os: ios
    uplink_trunk: "0/1"
    downlink_trunks:
      - "0/2"
  - name: sw-access
    address: 192.168.10.191
    ned_id: cisco-ios-cli-3.8:cisco-ios-cli-3.8
    os: ios
    uplink_trunk: "0/1"&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;Any suggestions/idea ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 14 Jan 2021 13:47:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/bad-keyref-14-illegal-reference-error/m-p/4272401#M6002</guid>
      <dc:creator>Stefano Pilla</dc:creator>
      <dc:date>2021-01-14T13:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: bad keyref (14): illegal reference error</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/bad-keyref-14-illegal-reference-error/m-p/4272431#M6003</link>
      <description>&lt;P&gt;** Disclaimer I have not use the repo you mention **&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;bad keyref (14): illegal reference error&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;means that you are not fulfilling a leafref constrain of the YANG model.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;following you error message it leads me to:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/CiscoDevNet/cml-cicd/blob/master/tests/vlan-service/src/yang/switch-topology.yang#L54" target="_blank"&gt;https://github.com/CiscoDevNet/cml-cicd/blob/master/tests/vlan-service/src/yang/switch-topology.yang#L54&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So in theory you should verify that you have whichever interface you are trying to refer to on the device in your NSO CDB. This means that you mean to make sure the interface exist on the device and that you have sync-from the configuration from the device so that it appears in your NSO CDB. In theory if you execute the test it is done at this step:&amp;nbsp;&lt;A href="https://github.com/CiscoDevNet/cml-cicd/blob/master/tests/populate_nso.py#L46" target="_blank"&gt;https://github.com/CiscoDevNet/cml-cicd/blob/master/tests/populate_nso.py#L46.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You should verify that your device configuration in NSO (the CDB view) when trying to deploy the service contains an interface GigabitEthernet 0/1.&lt;/P&gt;
&lt;P&gt;In NSO you can check with:&lt;/P&gt;
&lt;PRE&gt;show running-config devices device sw-core config interface&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 14:23:18 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/bad-keyref-14-illegal-reference-error/m-p/4272431#M6003</guid>
      <dc:creator>gmuloche</dc:creator>
      <dc:date>2021-01-14T14:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: bad keyref (14): illegal reference error</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/bad-keyref-14-illegal-reference-error/m-p/4272506#M6004</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/166202"&gt;@gmuloche&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;thank you for your input. It was indeed a reference to an interface still not present in the NSO CDB!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main issue was that NSO wasn't able to reach the device to perform a synch-from due a special character in the password (the script used to create the authgroup doesn't include the quotes) so I had to change that script and now everything is working ad expected!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help on this!!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 15:51:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/bad-keyref-14-illegal-reference-error/m-p/4272506#M6004</guid>
      <dc:creator>Stefano Pilla</dc:creator>
      <dc:date>2021-01-14T15:51:09Z</dc:date>
    </item>
  </channel>
</rss>

