cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
660
Views
5
Helpful
1
Replies

nornir_scrapli <bad-element>native</bad-element>

Cetanu
Level 1
Level 1

Hello,

I am creating a script using nornir_scrapli (netconf_edit_config) to replace some NTP config for a CSR1000v running 17.03.03, however I am getting the following error when running the script:

 

* CSR-17-3-3 ** changed : True *************************************************
vvvv load_vars_ios ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ERROR
Subtask: netconf_edit_config (failed)

---- load_yaml ** changed : False ---------------------------------------------- INFO
{ 'ios': { 'ntp': { 'servers': { 'ntp_server_1': '1.1.1.1',
                                 'ntp_server_2': '3.3.3.3',
                                 'ntp_server_3': '5.5.5.5'}}},
  'ios_xr': { 'ntp': { 'servers': { 'ntp_server_1': '2.2.2.2',
                                    'ntp_server_2': '4.4.4.4',
                                    'ntp_server_3': '6.6.6.6'}}}}
---- Building NTP Configuration ** changed : False ----------------------------- INFO
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"">
 <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
  <ntp operation="replace">
        <authentication-key xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-ntp">
          <number>4</number>
          <md5-cfg>05080F1C22431F5B4A</md5-cfg>
          <md5>05080F1C22431F5B4A</md5>
          <encryption-type>7</encryption-type>
        </authentication-key>
        <server xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-ntp">
          <server-list>
            <ip-address>1.1.1.1</ip-address>
          </server-list>
          <server-list>
            <ip-address>3.3.3.3</ip-address>
          </server-list>
          <server-list>
            <ip-address>5.5.5.5</ip-address>
            <prefer/>
          </server-list>
        </server>
        <trusted-key xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-ntp">
          <number>4</number>
        </trusted-key>
  </ntp>
 </native>
</config>


---- netconf_edit_config ** changed : True ------------------------------------- ERROR
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <rpc-error>
    <error-type>rpc</error-type>
    <error-tag>unknown-element</error-tag>
    <error-severity>error</error-severity>
    <error-info>
      <bad-element>native</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

^^^^ END load_vars_ios ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

What's weird is that the XML formatted config shown above is exactly the same as another script where I use ncclient instead of nornir_scrapli and it works without issues.

 

Does anyone have any ideas why I'm getting "<bad-element>native</bad-element>" when using nornir_scrapli but not with ncclient?

 

Thanks

1 Reply 1

Cetanu
Level 1
Level 1

Just a quick update, I had both "netconf ssh" and "netconf-yang" configured on this device. After removing "netconf-ssh" everything started working as expected.

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