In this article we are going to use ietf-interfaces YANG module as an example. Refer to the attachments.



Problem


Let us go through simple examples that will illustrate when this error may happen and how to solve it.

Assume you started the server with the following:


> netconfd-pro module=ietf-interfaces module=iana-if-type


And now you are trying to create an interface but getting a "missing parameter" error from the server.


yangcli-pro> /interfaces/interface/name value=vlan1
yangcli-pro> commit


At this point the server will reject the edit and will return an error as follows:


*** agt_val_root_check: start YANG datastore validation ***
agt_val: Start edit commit tests
run obj_commit_tests for interfaces
start run_external_xpath_tests for 'ietf-interfaces:interfaces'
run_instance_check: ietf-interfaces:interfaces start
instance_check 'ietf-interfaces:interface' against 'ietf-interfaces:interfaces'
    (cnt=1, min=0, max=unbounded)
run obj_commit_tests for interface
start run_external_xpath_tests for 'ietf-interfaces:interface'
run_instance_check: ietf-interfaces:interface start
instance_check 'ietf-interfaces:name' against 'ietf-interfaces:interface'
    (cnt=1, min=1, max=1)
instance_check 'ietf-interfaces:description' against 'ietf-interfaces:interface'
    (cnt=0, min=0, max=1)
instance_check 'ietf-interfaces:type' against 'ietf-interfaces:interface'
    (cnt=0, min=1, max=1)
agt_record_error for session 3:
instance_check 'ietf-interfaces:enabled' against 'ietf-interfaces:interface'
    (cnt=1, min=0, max=1)
instance_check 'ietf-interfaces:link-up-down-trap-enable' against 'ietf-interfaces:interface'
    (cnt=0, min=0, max=1)
agt_val: Finish edit commit tests
*** agt_val_root_check: end YANG datastore validation ***

agt_rpc: sending error <rpc-reply> for ses 3 msg '3'

ses_msg: send 1.1 buff:750 for s:3

trace_buff:

#740
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply message-id="3"
 xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"
 xmlns:ncx="http://netconfcentral.org/ns/yuma-ncx"
 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <rpc-error>
  <error-type>application</error-type>
  <error-tag>missing-element</error-tag>
  <error-severity>error</error-severity>
  <error-app-tag>data-incomplete</error-app-tag>
  <error-path>/if:interfaces/if:interface[if:name="vlan1"]/if:type</error-path>
  <error-message xml:lang="en">missing parameter</error-message>
  <error-info>
   <bad-element
    xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">if:type</bad-element>
   <error-number>233</error-number>
  </error-info>
 </rpc-error>
</rpc-reply>


Note that the error was generated during the Instance Check for a "type" leaf:


instance_check 'ietf-interfaces:type' against 'ietf-interfaces:interface'
    (cnt=0, min=1, max=1)
agt_record_error for session 3:


If you look up this leaf definition in the YANG module you can see that it has mandatory statement defined:


      leaf type {
        type identityref {
          base interface-type;
        }
        mandatory true;
        description
          "The type of the interface.

           When an interface entry is created, a server MAY
           initialize the type leaf with a valid value, e.g., if it
           is possible to derive the type from the name of the
           interface.

           If a client tries to set the type of an interface to a
           value that can never be used by the system, e.g., if the
           type is not supported or if the type does not match the
           name of the interface, the server MUST reject the request.
           A NETCONF server MUST reply with an rpc-error with the
           error-tag 'invalid-value' in this case.";
        reference
          "RFC 2863: The Interfaces Group MIB - ifType";
      }


To sum up, the server reported a "missing parameter" error because the "type" leaf must be set when you create interface entries because it is a mandatory leaf.


Solution


To solve this error you should just set the missing mandatory leaf along with the interface key name.
It is possible to set it in one command as follows:


> create /interfaces/interface[name='vlan1']/type value='ianaift:l2vlan'
> commit


Or create it in two separate commands before you commit the result as follows:
> /interfaces/interface/name value=vlan1
> /interfaces/interface/type value='ianaift:l2vlan'
> commit



NOTE


It is important to mention that the type of the "type" leaf is an identityref type leaf that is not defined in the ietf-interfaces YANG module. You will need to start the server with the following in order to provide all the identities definitions to the server since they are defined in the iana-if-type YANG module and not in the ietf-interfaces:


> netconfd-pro module=ietf-interfaces module=iana-if-type