ConfD User Community

Confd-basic-7.6 dowdload error with nc:operation and import different yang with attribute different value

Hi,

Confd-basic-7.6 is used and the yang files is compiled with commnad “confdc -c yangFiles”
When download xml to Confd wih netconf-console, there are two kind of errors. But the xml is Ok when download to real Device with Openconfig interface.

The xml mainly use modules of two yang file wich are openconfig-network-instance.yang and openconfig-bgp.yang.
In openconfig-network-instance.yang
import openconfig-bgp { prefix “oc-bgp”; }

from openconfig-bgp.yang

The related yang definition is:

       container protocols {
           description
             "The routing protocols that are enabled for this
             network-instance.";
 
           list protocol {
             key "identifier name";
 
             description
               "A process (instance) of a routing protocol. Some
               systems may not support more than one instance of
               a particular routing protocol";
 
             leaf identifier {
               type leafref {
                 path "../config/identifier";
               }
               description
                 "The protocol name for the routing or forwarding
                 protocol to be instantiated";
             }
 
             leaf name {
               type leafref {
                 path "../config/name";
               }
               description
                 "An operator-assigned identifier for the routing
                 or forwarding protocol. For some processes this
                 leaf may be system defined.";
             }
 
             container config {
               description
                 "Configuration parameters relating to the routing
                 protocol instance";
 
               uses protocols-config;
             }
 
             uses oc-bgp:bgp-top {
               when "./config/identifier = 'BGP'" {
                 description
                   "Include BGP parameters only when the protocol
                   is of type BGP";
               }
   
   
   grouping protocols-config {
     description
       "Configuration parameters relating to a generic protocol
       instance within a network instance";
 
     leaf identifier {
       type identityref {
         base "oc-pol-types:INSTALL_PROTOCOL_TYPE";
       }
       description
         "The protocol identifier for the instance";
     }
 
     leaf name {
       type string;
       description
         "A unique name for the protocol instance";
     }
 ......
   }

The download xml is:

<edit-config>
<target><candidate/></target>
<config>
<network-instances xmlns="http://openconfig.net/yang/network-instance" xmlns:oc-netinst="http://openconfig.net/yang/network-instance">
  <network-instance>
    <name>aa</name>
    <config>
      <name>aa</name>
      <type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:L3VRF</type>
    </config>
    <protocols>
      <protocol>
        <identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:BGP</identifier>
        <name>2</name>
        <config>
          <identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:BGP</identifier>
          <name>2</name>
          <enabled>true</enabled>
        </config>
        <bgp>
          <global>
            <config>
              <as>1</as>
			  \<router-id nc:operation="remove"\>\</router-id\>
            </config>
            <afi-safis>
              <afi-safi>
                <afi-safi-name xmlns:oc-bgp-types="http://openconfig.net/yang/bgp-types">oc-bgp-types:IPV4_UNICAST</afi-safi-name>
                <config>
                  <afi-safi-name xmlns:oc-bgp-types="http://openconfig.net/yang/bgp-types">oc-bgp-types:IPV4_UNICAST</afi-safi-name>
                  <enabled>true</enabled>
                </config>
              </afi-safi>
            </afi-safis>
          </global>
        </bgp>
      </protocol>
    </protocols>
  </network-instance>
</network-instances>
</config>
</edit-config>

Errors:
1 xml without <router-id nc:operation="remove"></router-id>. Error returned is:

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>unknown-element</error-tag>
    <error-severity>error</error-severity>
    <error-path xmlns:oc-netinst="http://openconfig.net/yang/network-instance">
    /rpc/edit-config/config/oc-netinst:network-instances/oc-netinst:network-instance[oc-netinst:name='aa']/oc-netinst:protocols/oc-netinst:protocol[oc-netinst:identifier='oc-pol-types:BGP'][oc-netinst:name='10032897']/oc-netinst:bgp
  </error-path>
    <error-message xml:lang="en">/network-instances/network-instance[name='aa']/protocols/protocol[identifier='oc-pol-types:BGP'][name='10032897']/bgp: the 'when' expression "./config/identifier = 'BGP'" failed</error-message>
    <error-info>
      <bad-element>bgp</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

2 xml with <router-id nc:operation="remove"></router-id>. Error returned is:

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <rpc-error>
    <error-type>rpc</error-type>
    <error-tag>malformed-message</error-tag>
    <error-severity>error</error-severity>
    <error-path xmlns:oc-netinst="http://openconfig.net/yang/network-instance">
    /rpc/edit-config/config/oc-netinst:network-instances/oc-netinst:network-instance/oc-netinst:protocols/oc-netinst:protocol/oc-netinst:bgp/oc-netinst:global/oc-netinst:config
  </error-path>
    <error-message xml:lang="en">'nc' is an unknown prefix.</error-message>
    <error-info>
      <bad-element>config</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

Does anyone knows how to sovle the problems. Thanks very much.

1 Like

Seems like nc namespace is not defined.

Can you try?:

<router-id xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="remove"></router-id>

router-id element in your XML looks strange:

\<router-id nc:operation="remove"\>\</router-id\>

Is there any reason for it?

<router-id xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="remove"></router-id>

Upper xml is OK and the strange xml is a writing mistake. Thanks.

Do you have any suggestions about error 1?

Thanky you very much.

For error 1, I do not have suggestion. Maybe you can get more description in the devel.log or in the netconf.trace (must be enabled in the conf.conf - `/confdConfig/logs/netconfTraceLog``).

netconfTraceLog records the same input text and it’s rerurn. It seems has no value to solve the problem.
Thanks anyway.