cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1619
Views
5
Helpful
3
Replies

NSO XML Template Problem

casbarre
Cisco Employee
Cisco Employee

Hello everyone!

 

After upgrading NSO 4.7 to NSO 5.7, I tried to add previous Services to the new NSO version but when I perform a packages reload, a XML template error is displayed: "The node: [node-name] contains unxpected data". 

 

These are the services I'm trying to add to NSO:

 

packages package l3vpn
 oper-status file-load-error
 oper-status error-info [ "vrp-route-policy.xml:83 The node: as-path-filter contains unexpected data: '{as-path-match-name}'." "l3vpn-vrp-template.xml:403 The node: load-balancing contains unexpected data: '{routing-protocol/vr...'." ]
packages package rsvp-te-tunnel
 oper-status file-load-error
 oper-status error-info [ "rsvp-te-tunnel-template.xml:170 The node: destination contains unexpected data: '{$TAILEND_LOOPBACK_I...'." ]

 

For example, L3VPN's vrp-route-policy.xml line 83 looks like this:

 

<as-path-filter when="{type='as-path'}">{as-path-match-name}</as-path-filter>

 

RPSV-TE-TUNNEL's rsvp-te-tunnel-template.xml line 170 looks like this:

 

 <destination>{$TAILEND_LOOPBACK_IP}</destination>

 

I'm not sure if there is something wrong with the templates or the YANG models. What should I check to fix this problem?

 

Thank you in advance!

1 Accepted Solution

Accepted Solutions

Since your problem is concerning  only the huawei-vrp. I  will focus only on your problem using Huawei vrp 6.22.4 . I faced the  same issue.

 

I think you are facing this problem because you upgrade to a newer version of the NED even if it's not the last one and the yang model of the configuration that you are trying to push changed . You  will have to change your template in order to fix your problem.  You should keep in mind it's better to use the latest version

 

Please test again your package against REAL Device .

 

So to solve i started by creating  NETSIM in order to generate the new XML template

 

nabil@DESKTOP-8ECTID4:~/ncs-run-5.7.2.1$ ncs-netsim create-network packages/huawei-vrp-cli-6.22/  1 NETSIM-VRP-
DEVICE NETSIM-VRP-0 CREATED
nabil@DESKTOP-8ECTID4:~/ncs-run-5.7.2.1$ ncs-netsim start
Loading.
17 bytes parsed in 0.29 sec (57 bytes/sec)
DEVICE NETSIM-VRP-0 OK STARTED
nabil@DESKTOP-8ECTID4:~/ncs-run-5.7.2.1$ ncs-netsim ncs-xml-init  NETSIM-VRP-0
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>NETSIM-VRP-0</name>
<address>127.0.0.1</address>
<port>10022</port>
<ssh>
<host-key>
<algorithm>ssh-ed25519</algorithm>
<key-data>ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPbbKtetr97CPxfitcIzhYXJxWS4HSuZ7NBTmgU6Lw4C nabil@DESKTOP-8ECTID4</key-data>
</host-key>
<host-key>
<algorithm>ssh-rsa</algorithm>
<key-data>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDKgyIpx0AlNwEzs7zGgnkEDut5E7ztNgo5FMqJ5v8Pp5+nIgkwrbvL7mAwl9kybU69pJvM3vAbzruVDvmYA6jJwvtbWzWMoGkna
hQQsTVRaCCpVBOYQzFckrhLBy4O1y8GZwR1jadwNDMkaqoEssF9Yjfy+eTuqff6N0WxTbbPEOPWJ8y5LM5iHKUF9gp3bcRta+iRpxwrDEcUfJOpsCKXOXiXU7DKsJjn/WlVLoSOCrEW2gRMqkgmqr8HW7pDQ
hfzQcr7qeFbYUi3wPSd1Zb9gXDq2x514gvWkJesXlskGvPoTemGcPWdy0z7KH7v7iOGKqBJGSaiPlucQL4QOZfUjy6xnjt0KHCFJ0/y1I2LXoO6RSyoFk7XZ5NphgB2lWMHm5VtdYzJyqcyWBU4tOqEOfBsd
0ro48c2lXTU2sZ8D+jxjUsxhrax/Zo9D9lmgegItKBm9Ja5NIBbfumf1x61sbcoXyahbP5B00oURo1WVDR7N9qHHeDJ4GS8aTzxLpM= nabil@DESKTOP-8ECTID4</key-data>
</host-key>
</ssh>
<ssh-algorithms>
<public-key>ssh-ed25519</public-key>
<public-key>ssh-rsa</public-key>
</ssh-algorithms>
<state>
<admin-state>unlocked</admin-state>
</state>
<authgroup>default</authgroup>
<device-type>
<cli>
<ned-id xmlns:id="http://tail-f.com/ns/ned-id/huawei-vrp-cli-6.22">id:huawei-vrp-cli-6.22</ned-id>
</cli>
</device-type>
</device>
</devices>

Then i load the NETSIM in NSO and try to configure the NETSIM in order to get the XML config. 

 

 

admin@ncs(config)# show configuration
devices device NETSIM-VRP-0
 config
  interface Tunnel0/0/3
   destination 1.1.1.1
   no shutdown
  exit
 !
!
admin@ncs(config)# commit dry-run outformat xml
result-xml {
    local-node {
        data <devices xmlns="http://tail-f.com/ns/ncs">
               <device>
                 <name>NETSIM-VRP-0</name>
                 <config>
                   <interface xmlns="http://tail-f.com/ned/huawei-vrp">
                     <Tunnel>
                       <name>0/0/3</name>
                       <destination>
                         <address>1.1.1.1</address>
                       </destination>
                     </Tunnel>
                   </interface>
                 </config>
               </device>
             </devices>
    }
}

 

 

The route-policy part :

 

 

admin@ncs(config)# show conf
devices device NETSIM-VRP-0
 config
  route-policy TEST node 1
   if-match as-path-filter AAA
  !
 !
!
admin@ncs(config)# commit dry-run outformat xml
result-xml {
    local-node {
        data <devices xmlns="http://tail-f.com/ns/ncs">
               <device>
                 <name>NETSIM-VRP-0</name>
                 <config>
                   <route-policy xmlns="http://tail-f.com/ned/huawei-vrp">
                     <name>TEST</name>
                     <node>1</node>
                     <if-match>
                       <as-path-filter>
                         <id>AAA</id>
                       </as-path-filter>
                     </if-match>
                   </route-policy>
                 </config>
               </device>
             </devices>
    }
}

The as-path part :

 

 

admin@ncs(config)# show configuration
devices device NETSIM-VRP-0
 config
  route-policy TEST permit node 10
   apply as-path 65000 67000 additive
  !
 !
!
admin@ncs(config)# commit dry-run outformat xml
result-xml {
    local-node {
        data <devices xmlns="http://tail-f.com/ns/ncs">
               <device>
                 <name>NETSIM-VRP-0</name>
                 <config>
                   <route-policy xmlns="http://tail-f.com/ned/huawei-vrp">
                     <name>TEST</name>
                     <node>10</node>
                     <rule>permit</rule>
                     <apply>
                       <as-path>65000 67000 additive</as-path>
                     </apply>
                   </route-policy>
                 </config>
               </device>
             </devices>
    }
}

 

 

 

So i changed your template and try to reload the package.

 

Here the changes

 

nabil@DESKTOP-8ECTID4:~/ncs-run-5.7.2.1/packages/test-package/templates$ diff -U 0 test-package-template.xml.orig test-package-template.xml
--- test-package-template.xml.orig      2022-05-11 20:13:31.770874600 +0200
+++ test-package-template.xml   2022-05-11 20:35:08.890874600 +0200
@@ -39 +39,3 @@
-            <destination>{$TAILEND_LOOPBACK_IP}</destination>
+            <destination>
+       <address>{$TAILEND_LOOPBACK_IP}</address>
+          </destination>
@@ -71 +73,3 @@
-            <as-path-filter when="{type='as-path'}">{as-path-match-name}</as-path-filter>
+            <as-path-filter when="{type='as-path'}">
+          <id>{as-path-match-name}</id>
+            </as-path-filter>
@@ -81,6 +85 @@
-            <as-path when="{policy-set/as-path}">
-              <?foreach {policy-set/as-path/as-number}?>
-              <as-number>{current()}</as-number>
-             <operation>additive</operation>
-             <?end?>
-            </as-path>
+              <as-path when="{policy-set/as-path}">{concat(policy-set/as-path/as-number,'additive')}</as-path>

 

 

Here the output that i got before the modification

 

 

reload-result {
    package test-package
    result false
    info test-package-template.xml:39 The node: destination contains unexpected data: '{$TAILEND_LOOPBACK_I...'.
}

 

 

I got this new error-message

 

 

reload-result {
    package test-package
    result false
    info test-package-template.xml:87 Unknown element: 'as-number' for ned-id: huawei-vrp-cli-6.22:huawei-vrp-cli-6.22
}

 

Concering this error , i fixed the package reload message by changing your template. Since i have never used a concat on list . You should try it  and see if it's working as you expect

 

<as-path when="{policy-set/as-path}">{concat(policy-set/as-path/as-number,'additive')}</as-path>

 

 

Then after the modification the package is up.

 

 

admin@ncs# packages reload

>>> System upgrade is starting.
>>> Sessions in configure mode must exit to operational mode.
>>> No configuration changes can be performed until upgrade has completed.
>>> System upgrade has completed successfully.
reload-result {
    package huawei-vrp-cli-6.22
    result true
}
reload-result {
    package test-package
    result true
}

 

 

 

Here the XML File

 

 

<config-template xmlns="http://tail-f.com/ns/config/1.0">
  <devices xmlns="http://tail-f.com/ns/ncs">
    <device>
      <!--
          Select the devices from some data structure in the service
          model. In this skeleton the devices are specified in a leaf-list.
          Select all devices in that leaf-list:
      -->
      <name>{/device}</name>
      <config>
        <!--
            Add device-specific parameters here.
            In this skeleton the, java code sets a variable DUMMY, use it
            to set something on the device e.g.:
            <ip-address-on-device>{$DUMMY}</ip-address-on-device>
        -->

<interface xmlns="http://tail-f.com/ned/huawei-vrp">
          <Tunnel>
            <name>0/0/{$TUNNEL_ID}</name>
            <description>NSO_Tactical Tunnel_to_{/tailend-router}</description>
            <ip>
              <address>
                <unnumbered>
                  <interface>
                    <LoopBack>0</LoopBack>
                  </interface>
                </unnumbered>
              </address>
            </ip>
            <isis>
              <enable>{/isis-process}</enable>
            </isis>
            <tunnel-protocol>
              <mpls>
                <te/>
              </mpls>
            </tunnel-protocol>
            <destination>
        <address>{$TAILEND_LOOPBACK_IP}</address>
           </destination>
            <mpls>
              <te>
                <tunnel-id>{$TUNNEL_ID}</tunnel-id>
                <record-route>
                  <label/>
                </record-route>
                <path>
                  <explicit-path>NSO_TACTICAL_TE_{$TUNNEL_ID}_PRI</explicit-path>
                </path>
                <fast-reroute/>
                <igp>
                  <shortcut/>
                  <metric>
                    <absolute>{/igp-metric}</absolute>
                  </metric>
                </igp>
              </te>
            </mpls>
            <statistic>
              <enable/>
            </statistic>
          </Tunnel>
        </interface>

<route-policy xmlns="http://tail-f.com/ned/huawei-vrp">
          <name>{$ROUTE_POLICY_NAME}</name>
          <node>{node}</node>
          <rule>{rule}</rule>
          <?foreach {policy-match}?>
          <if-match>
            <ip-prefix when="{type='prefix-match'}">{prefix-match-name}</ip-prefix>
            <as-path-filter when="{type='as-path'}">
           <id>{as-path-match-name}</id>
            </as-path-filter>
            <community-filter when="{type='community-match'}">
               <name>{community-match-name}</name>
             </community-filter>
             <community-filter when="{type='community-basic-match'}">
               <name>{community-basic-match-name}</name>
             </community-filter>
            <tag when="{type='tag'}">{tag/set-name}</tag>
          </if-match>
          <apply>
              <as-path when="{policy-set/as-path}">{concat(policy-set/as-path/as-number,'additive')}</as-path>
            <tag>{policy-set/tag}</tag>
            <?set EXTCOMMN={none}?>
            <?set EXTCOMMNS={""}?>
            <?if {policy-set/extcommunity-rt}?>
            <?foreach {policy-set/extcommunity-rt}?>
            <?set EXTCOMMN={current()}?>
            <?set EXTCOMMNS={concat($EXTCOMMNS," rt ",$EXTCOMMN)}?>
            <?end?>
            <extcommunity>{normalize-space($EXTCOMMNS)} additive</extcommunity>
            <?end?>
            <?set COMMN={none}?>
            <?set COMMNS={""}?>
            <?if {policy-set/community}?>
            <?foreach {policy-set/community}?>
            <?set COMMN={current()}?>
            <?set COMMNS={concat($COMMNS," ",$COMMN)}?>
            <?end?>
            <?set COMMNS={normalize-space($COMMNS)}?>
            <community>{$COMMNS} additive</community>
            <?end?>
            <local-preference>{policy-set/local-preference}</local-preference>
            <cost>{policy-set/cost}</cost>
          </apply>
          <?end?>
        </route-policy>


      </config>
    </device>
  </devices>
</config-template>

 

 

 

View solution in original post

3 Replies 3

Nabsch
Spotlight
Spotlight

Hello ,

 

Which ned are you using ? Can you provide us the name and the version ?

 

Could you put also the part of template that’s not working ?

 

 

Hi.

 

The NEDs I'm using are:

cisco-iosxr:

cisco-iosxr-cli-7.33 (Full name)

huawei-vrp:

huawei-vrp-cli-6.22 (Full name)

juniper-junos:

juniper-junos-nc-4.6 (Full name)

cisco-ios:

cisco-ios-cli-6.69 (Full name)

 

 

RSPV-TE-TUNNEL Template (the failing line is highlighted):

 

<interface xmlns="http://tail-f.com/ned/huawei-vrp">
          <Tunnel>
            <name>0/0/{$TUNNEL_ID}</name>
            <description>NSO_Tactical Tunnel_to_{/tailend-router}</description>
            <ip>
              <address>
                <unnumbered>
                  <interface>
                    <LoopBack>0</LoopBack>
                  </interface>
                </unnumbered>
              </address>
            </ip>
            <isis>
              <enable>{/isis-process}</enable>
            </isis>
            <tunnel-protocol>
              <mpls>
                <te/>
              </mpls>
            </tunnel-protocol>
            <destination>{$TAILEND_LOOPBACK_IP}</destination>
            <mpls>
              <te>
                <tunnel-id>{$TUNNEL_ID}</tunnel-id>
                <record-route>
                  <label/>
                </record-route>
                <path>
                  <explicit-path>NSO_TACTICAL_TE_{$TUNNEL_ID}_PRI</explicit-path>
                </path>
                <fast-reroute/>
                <igp>
                  <shortcut/>
                  <metric>
                    <absolute>{/igp-metric}</absolute>
                  </metric>
                </igp>
              </te>
            </mpls>
            <statistic>
              <enable/>
            </statistic>
          </Tunnel>
        </interface>

 

L3VPN Template (the failing line is highlighted):

 

 <route-policy xmlns="http://tail-f.com/ned/huawei-vrp">
          <name>{$ROUTE_POLICY_NAME}</name>
          <node>{node}</node>
          <rule>{rule}</rule>
          <?foreach {policy-match}?>
          <if-match>
            <ip-prefix when="{type='prefix-match'}">{prefix-match-name}</ip-prefix>
            <as-path-filter when="{type='as-path'}">{as-path-match-name}</as-path-filter>
            <community-filter when="{type='community-match'}">
               <name>{community-match-name}</name>
             </community-filter>
             <community-filter when="{type='community-basic-match'}">
               <name>{community-basic-match-name}</name>
             </community-filter>
            <tag when="{type='tag'}">{tag/set-name}</tag>
          </if-match>
          <apply>
            <as-path when="{policy-set/as-path}">
              <?foreach {policy-set/as-path/as-number}?>
              <as-number>{current()}</as-number>
             <operation>additive</operation>
             <?end?>
            </as-path>
            <tag>{policy-set/tag}</tag>
            <?set EXTCOMMN={none}?>
            <?set EXTCOMMNS={""}?>
            <?if {policy-set/extcommunity-rt}?>
            <?foreach {policy-set/extcommunity-rt}?>
            <?set EXTCOMMN={current()}?>
            <?set EXTCOMMNS={concat($EXTCOMMNS," rt ",$EXTCOMMN)}?>
            <?end?>
            <extcommunity>{normalize-space($EXTCOMMNS)} additive</extcommunity>
            <?end?>
            <?set COMMN={none}?>
            <?set COMMNS={""}?>
            <?if {policy-set/community}?>
            <?foreach {policy-set/community}?>
            <?set COMMN={current()}?>
            <?set COMMNS={concat($COMMNS," ",$COMMN)}?>
            <?end?>
            <?set COMMNS={normalize-space($COMMNS)}?>
            <community>{$COMMNS} additive</community>
            <?end?>
            <local-preference>{policy-set/local-preference}</local-preference>
            <cost>{policy-set/cost}</cost>
          </apply>
          <?end?>
        </route-policy>

Since your problem is concerning  only the huawei-vrp. I  will focus only on your problem using Huawei vrp 6.22.4 . I faced the  same issue.

 

I think you are facing this problem because you upgrade to a newer version of the NED even if it's not the last one and the yang model of the configuration that you are trying to push changed . You  will have to change your template in order to fix your problem.  You should keep in mind it's better to use the latest version

 

Please test again your package against REAL Device .

 

So to solve i started by creating  NETSIM in order to generate the new XML template

 

nabil@DESKTOP-8ECTID4:~/ncs-run-5.7.2.1$ ncs-netsim create-network packages/huawei-vrp-cli-6.22/  1 NETSIM-VRP-
DEVICE NETSIM-VRP-0 CREATED
nabil@DESKTOP-8ECTID4:~/ncs-run-5.7.2.1$ ncs-netsim start
Loading.
17 bytes parsed in 0.29 sec (57 bytes/sec)
DEVICE NETSIM-VRP-0 OK STARTED
nabil@DESKTOP-8ECTID4:~/ncs-run-5.7.2.1$ ncs-netsim ncs-xml-init  NETSIM-VRP-0
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>NETSIM-VRP-0</name>
<address>127.0.0.1</address>
<port>10022</port>
<ssh>
<host-key>
<algorithm>ssh-ed25519</algorithm>
<key-data>ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPbbKtetr97CPxfitcIzhYXJxWS4HSuZ7NBTmgU6Lw4C nabil@DESKTOP-8ECTID4</key-data>
</host-key>
<host-key>
<algorithm>ssh-rsa</algorithm>
<key-data>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDKgyIpx0AlNwEzs7zGgnkEDut5E7ztNgo5FMqJ5v8Pp5+nIgkwrbvL7mAwl9kybU69pJvM3vAbzruVDvmYA6jJwvtbWzWMoGkna
hQQsTVRaCCpVBOYQzFckrhLBy4O1y8GZwR1jadwNDMkaqoEssF9Yjfy+eTuqff6N0WxTbbPEOPWJ8y5LM5iHKUF9gp3bcRta+iRpxwrDEcUfJOpsCKXOXiXU7DKsJjn/WlVLoSOCrEW2gRMqkgmqr8HW7pDQ
hfzQcr7qeFbYUi3wPSd1Zb9gXDq2x514gvWkJesXlskGvPoTemGcPWdy0z7KH7v7iOGKqBJGSaiPlucQL4QOZfUjy6xnjt0KHCFJ0/y1I2LXoO6RSyoFk7XZ5NphgB2lWMHm5VtdYzJyqcyWBU4tOqEOfBsd
0ro48c2lXTU2sZ8D+jxjUsxhrax/Zo9D9lmgegItKBm9Ja5NIBbfumf1x61sbcoXyahbP5B00oURo1WVDR7N9qHHeDJ4GS8aTzxLpM= nabil@DESKTOP-8ECTID4</key-data>
</host-key>
</ssh>
<ssh-algorithms>
<public-key>ssh-ed25519</public-key>
<public-key>ssh-rsa</public-key>
</ssh-algorithms>
<state>
<admin-state>unlocked</admin-state>
</state>
<authgroup>default</authgroup>
<device-type>
<cli>
<ned-id xmlns:id="http://tail-f.com/ns/ned-id/huawei-vrp-cli-6.22">id:huawei-vrp-cli-6.22</ned-id>
</cli>
</device-type>
</device>
</devices>

Then i load the NETSIM in NSO and try to configure the NETSIM in order to get the XML config. 

 

 

admin@ncs(config)# show configuration
devices device NETSIM-VRP-0
 config
  interface Tunnel0/0/3
   destination 1.1.1.1
   no shutdown
  exit
 !
!
admin@ncs(config)# commit dry-run outformat xml
result-xml {
    local-node {
        data <devices xmlns="http://tail-f.com/ns/ncs">
               <device>
                 <name>NETSIM-VRP-0</name>
                 <config>
                   <interface xmlns="http://tail-f.com/ned/huawei-vrp">
                     <Tunnel>
                       <name>0/0/3</name>
                       <destination>
                         <address>1.1.1.1</address>
                       </destination>
                     </Tunnel>
                   </interface>
                 </config>
               </device>
             </devices>
    }
}

 

 

The route-policy part :

 

 

admin@ncs(config)# show conf
devices device NETSIM-VRP-0
 config
  route-policy TEST node 1
   if-match as-path-filter AAA
  !
 !
!
admin@ncs(config)# commit dry-run outformat xml
result-xml {
    local-node {
        data <devices xmlns="http://tail-f.com/ns/ncs">
               <device>
                 <name>NETSIM-VRP-0</name>
                 <config>
                   <route-policy xmlns="http://tail-f.com/ned/huawei-vrp">
                     <name>TEST</name>
                     <node>1</node>
                     <if-match>
                       <as-path-filter>
                         <id>AAA</id>
                       </as-path-filter>
                     </if-match>
                   </route-policy>
                 </config>
               </device>
             </devices>
    }
}

The as-path part :

 

 

admin@ncs(config)# show configuration
devices device NETSIM-VRP-0
 config
  route-policy TEST permit node 10
   apply as-path 65000 67000 additive
  !
 !
!
admin@ncs(config)# commit dry-run outformat xml
result-xml {
    local-node {
        data <devices xmlns="http://tail-f.com/ns/ncs">
               <device>
                 <name>NETSIM-VRP-0</name>
                 <config>
                   <route-policy xmlns="http://tail-f.com/ned/huawei-vrp">
                     <name>TEST</name>
                     <node>10</node>
                     <rule>permit</rule>
                     <apply>
                       <as-path>65000 67000 additive</as-path>
                     </apply>
                   </route-policy>
                 </config>
               </device>
             </devices>
    }
}

 

 

 

So i changed your template and try to reload the package.

 

Here the changes

 

nabil@DESKTOP-8ECTID4:~/ncs-run-5.7.2.1/packages/test-package/templates$ diff -U 0 test-package-template.xml.orig test-package-template.xml
--- test-package-template.xml.orig      2022-05-11 20:13:31.770874600 +0200
+++ test-package-template.xml   2022-05-11 20:35:08.890874600 +0200
@@ -39 +39,3 @@
-            <destination>{$TAILEND_LOOPBACK_IP}</destination>
+            <destination>
+       <address>{$TAILEND_LOOPBACK_IP}</address>
+          </destination>
@@ -71 +73,3 @@
-            <as-path-filter when="{type='as-path'}">{as-path-match-name}</as-path-filter>
+            <as-path-filter when="{type='as-path'}">
+          <id>{as-path-match-name}</id>
+            </as-path-filter>
@@ -81,6 +85 @@
-            <as-path when="{policy-set/as-path}">
-              <?foreach {policy-set/as-path/as-number}?>
-              <as-number>{current()}</as-number>
-             <operation>additive</operation>
-             <?end?>
-            </as-path>
+              <as-path when="{policy-set/as-path}">{concat(policy-set/as-path/as-number,'additive')}</as-path>

 

 

Here the output that i got before the modification

 

 

reload-result {
    package test-package
    result false
    info test-package-template.xml:39 The node: destination contains unexpected data: '{$TAILEND_LOOPBACK_I...'.
}

 

 

I got this new error-message

 

 

reload-result {
    package test-package
    result false
    info test-package-template.xml:87 Unknown element: 'as-number' for ned-id: huawei-vrp-cli-6.22:huawei-vrp-cli-6.22
}

 

Concering this error , i fixed the package reload message by changing your template. Since i have never used a concat on list . You should try it  and see if it's working as you expect

 

<as-path when="{policy-set/as-path}">{concat(policy-set/as-path/as-number,'additive')}</as-path>

 

 

Then after the modification the package is up.

 

 

admin@ncs# packages reload

>>> System upgrade is starting.
>>> Sessions in configure mode must exit to operational mode.
>>> No configuration changes can be performed until upgrade has completed.
>>> System upgrade has completed successfully.
reload-result {
    package huawei-vrp-cli-6.22
    result true
}
reload-result {
    package test-package
    result true
}

 

 

 

Here the XML File

 

 

<config-template xmlns="http://tail-f.com/ns/config/1.0">
  <devices xmlns="http://tail-f.com/ns/ncs">
    <device>
      <!--
          Select the devices from some data structure in the service
          model. In this skeleton the devices are specified in a leaf-list.
          Select all devices in that leaf-list:
      -->
      <name>{/device}</name>
      <config>
        <!--
            Add device-specific parameters here.
            In this skeleton the, java code sets a variable DUMMY, use it
            to set something on the device e.g.:
            <ip-address-on-device>{$DUMMY}</ip-address-on-device>
        -->

<interface xmlns="http://tail-f.com/ned/huawei-vrp">
          <Tunnel>
            <name>0/0/{$TUNNEL_ID}</name>
            <description>NSO_Tactical Tunnel_to_{/tailend-router}</description>
            <ip>
              <address>
                <unnumbered>
                  <interface>
                    <LoopBack>0</LoopBack>
                  </interface>
                </unnumbered>
              </address>
            </ip>
            <isis>
              <enable>{/isis-process}</enable>
            </isis>
            <tunnel-protocol>
              <mpls>
                <te/>
              </mpls>
            </tunnel-protocol>
            <destination>
        <address>{$TAILEND_LOOPBACK_IP}</address>
           </destination>
            <mpls>
              <te>
                <tunnel-id>{$TUNNEL_ID}</tunnel-id>
                <record-route>
                  <label/>
                </record-route>
                <path>
                  <explicit-path>NSO_TACTICAL_TE_{$TUNNEL_ID}_PRI</explicit-path>
                </path>
                <fast-reroute/>
                <igp>
                  <shortcut/>
                  <metric>
                    <absolute>{/igp-metric}</absolute>
                  </metric>
                </igp>
              </te>
            </mpls>
            <statistic>
              <enable/>
            </statistic>
          </Tunnel>
        </interface>

<route-policy xmlns="http://tail-f.com/ned/huawei-vrp">
          <name>{$ROUTE_POLICY_NAME}</name>
          <node>{node}</node>
          <rule>{rule}</rule>
          <?foreach {policy-match}?>
          <if-match>
            <ip-prefix when="{type='prefix-match'}">{prefix-match-name}</ip-prefix>
            <as-path-filter when="{type='as-path'}">
           <id>{as-path-match-name}</id>
            </as-path-filter>
            <community-filter when="{type='community-match'}">
               <name>{community-match-name}</name>
             </community-filter>
             <community-filter when="{type='community-basic-match'}">
               <name>{community-basic-match-name}</name>
             </community-filter>
            <tag when="{type='tag'}">{tag/set-name}</tag>
          </if-match>
          <apply>
              <as-path when="{policy-set/as-path}">{concat(policy-set/as-path/as-number,'additive')}</as-path>
            <tag>{policy-set/tag}</tag>
            <?set EXTCOMMN={none}?>
            <?set EXTCOMMNS={""}?>
            <?if {policy-set/extcommunity-rt}?>
            <?foreach {policy-set/extcommunity-rt}?>
            <?set EXTCOMMN={current()}?>
            <?set EXTCOMMNS={concat($EXTCOMMNS," rt ",$EXTCOMMN)}?>
            <?end?>
            <extcommunity>{normalize-space($EXTCOMMNS)} additive</extcommunity>
            <?end?>
            <?set COMMN={none}?>
            <?set COMMNS={""}?>
            <?if {policy-set/community}?>
            <?foreach {policy-set/community}?>
            <?set COMMN={current()}?>
            <?set COMMNS={concat($COMMNS," ",$COMMN)}?>
            <?end?>
            <?set COMMNS={normalize-space($COMMNS)}?>
            <community>{$COMMNS} additive</community>
            <?end?>
            <local-preference>{policy-set/local-preference}</local-preference>
            <cost>{policy-set/cost}</cost>
          </apply>
          <?end?>
        </route-policy>


      </config>
    </device>
  </devices>
</config-template>