YANG模型中<rpc-error>的定义

1.grouping errors 源码

grouping errors {

       description
         "A grouping that contains a YANG container
          representing the syntax and semantics of a
          YANG Patch errors report within a response message.";

       container errors {
         config false;  // needed so list error does not need a key
         description
           "Represents an error report returned by the server if
            a request results in an error.";

         list error {
           description
             "An entry containing information about one
              specific error that occurred while processing
              a RESTCONF request.";
           reference "RFC 6241, Section 4.3";

           leaf error-type {
             type enumeration {
               enum transport {
                 description "The transport layer";
               }
               enum rpc {
                 description "The rpc or notification layer";
               }
               enum protocol {
                 description "The protocol operation layer";
               }
               enum application {
                 description "The server application layer";
               }
             }
             mandatory true;
             description
               "The protocol layer where the error occurred.";
           }

           leaf error-tag {
             type string;
             mandatory true;
             description
               "The enumerated error tag.";
           }

           leaf error-app-tag {
             type string;
             description
               "The application-specific error tag.";
           }

           leaf error-path {
             type data-resource-identifier;
             description
               "The target data resource identifier associated
                with the error, if any.";
           }
           leaf error-message {
             type string;
             description
               "A message describing the error.";
           }

           container error-info {
              description
                "A container allowing additional information
                 to be included in the error report.";
              // arbitrary anyxml content here
           }
         }
       }
     } 

2.定义的节点的解释

报文中各字段含义:
(1)error-type:定义错误发生在协议的层级,有四种取值:transport传输层,RPC远程进程调用,protocol协议层,application应用层。
(2) error-tag:标识错误信息内容。
(3)error-app-tag:标识特定的错误情形。对于一个特殊的错误情形,如果没有合适的与之关联,则此元素不会出现。
(4)error-path:标识出错的位置及具体文件名称。
(5)error-message:描述出错内容。
(6)error-info:含有协议或者数据模型特定的错误内容。对于一个特殊的错误情形,如果没有提供合适的,这个元素就不会出现。

3.示例

<?xml version="1.0" encoding="utf-8"?>
 <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3">
  <rpc-error>
   <error-type>application</error-type>
   <error-tag>bad-element</error-tag>
   <error-severity>error</error-severity>
   <error-app-tag>43</error-app-tag>
   <error-path xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
	  xmlns:acl="http://xxxxx">xxxxxxxx</error-path>
   <error-message xml:lang="en">xxxxxx</error-message>
   <error-info>
    <bad-element>xxxxxxx</bad-element>
  </error-info>
 </rpc-error>
</rpc-reply>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-5">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-not-supported</error-tag>
    <error-severity>error</error-severity>
    <error-app-tag>no-support</error-app-tag>
    <error-path>/wdm-pg:pgs/wdm-pg:pg[wdm-pg:pg-id='23']</error-path>
    <error-message xml:lang="en">operation not supported</error-message>
    <error-info>
      <error-number xmlns="http://netconfcentral.org/ns/yuma-ncx">273</error-number>
    </error-info>
  </rpc-error>
</rpc-reply>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值