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

Error when import/merge an xml file

oscj
Spotlight
Spotlight

Hej
I am trying to import and merge bunch of devices from an xml file but I get the below error

The problem seems to be "spacing" related but as far as I can see all the spacing seems fine

oscj@oscar:~$ ncs_load -lm downloads/oscar.xml 
ncs_load: 645: maapi_load_config(sock, tid, flags, abspath(argv[0])) failed: external error (19): Error on line 1: unknown namespace:  in device

This is first 3 devices in the XML file. I have taken the xml template from a working device in the NSO instance.

<device>
  <name>Oscar-Cust-3</name>
  <address>10.250.10.103</address>
  <port>830</port>
  <authgroup>Oscar</authgroup>
  <device-type>
    <netconf>
      <ned-id xmlns:juniper-junos-nc-3.0="http://tail-f.com/ns/ned-id/juniper-junos-nc-3.0">juniper-junos-nc-3.0:juniper-junos-nc-3.0</ned-id>
    </netconf>
  </device-type>
  <state>
    <admin-state>unlocked</admin-state>
  </state>
</device>
<device>
  <name>Oscar-Cust-4</name>
  <address>10.250.10.104</address>
  <port>830</port>
  <authgroup>Oscar</authgroup>
  <device-type>
    <netconf>
      <ned-id xmlns:juniper-junos-nc-3.0="http://tail-f.com/ns/ned-id/juniper-junos-nc-3.0">juniper-junos-nc-3.0:juniper-junos-nc-3.0</ned-id>
    </netconf>
  </device-type>
  <state>
    <admin-state>unlocked</admin-state>
  </state>
</device>
<device>
  <name>Oscar-PE-1</name>
  <address>10.250.10.111</address>
  <port>830</port>
  <authgroup>Oscar</authgroup>
  <device-type>
    <netconf>
      <ned-id xmlns:juniper-junos-nc-3.0="http://tail-f.com/ns/ned-id/juniper-junos-nc-3.0">juniper-junos-nc-3.0:juniper-junos-nc-3.0</ned-id>
    </netconf>
  </device-type>
  <state>
    <admin-state>unlocked</admin-state>
  </state>
</device>

 

1 Reply 1

Marcel Zehnder
Spotlight
Spotlight

Hi

Try to wrap your xml in config tags like this:

<config xmlns="http://tail-f.com/ns/config/1.0">
  <devices xmlns="http://tail-f.com/ns/ncs">
<device>
  <name>Oscar-Cust-3</name>
  <address>10.250.10.103</address>
  <port>830</port>
  <authgroup>Oscar</authgroup>
  <device-type>
    <netconf>
      <ned-id xmlns:juniper-junos-nc-3.0="http://tail-f.com/ns/ned-id/juniper-junos-nc-3.0">juniper-junos-nc-3.0:juniper-junos-nc-3.0</ned-id>
    </netconf>
  </device-type>
  <state>
    <admin-state>unlocked</admin-state>
  </state>
</device>
<device>
  <name>Oscar-Cust-4</name>
  <address>10.250.10.104</address>
  <port>830</port>
  <authgroup>Oscar</authgroup>
  <device-type>
    <netconf>
      <ned-id xmlns:juniper-junos-nc-3.0="http://tail-f.com/ns/ned-id/juniper-junos-nc-3.0">juniper-junos-nc-3.0:juniper-junos-nc-3.0</ned-id>
    </netconf>
  </device-type>
  <state>
    <admin-state>unlocked</admin-state>
  </state>
</device>
<device>
  <name>Oscar-PE-1</name>
  <address>10.250.10.111</address>
  <port>830</port>
  <authgroup>Oscar</authgroup>
  <device-type>
    <netconf>
      <ned-id xmlns:juniper-junos-nc-3.0="http://tail-f.com/ns/ned-id/juniper-junos-nc-3.0">juniper-junos-nc-3.0:juniper-junos-nc-3.0</ned-id>
    </netconf>
  </device-type>
  <state>
    <admin-state>unlocked</admin-state>
  </state>
</device>
  </devices>
</config>

HTH

Marcel