简体   繁体   English

此阳通知有效吗?

[英]how is this yang notification valid?

yang 1.1 spec has this example, The following example defines a notification in a data node: yang 1.1 spec包含此示例,以下示例定义了数据节点中的通知:

 module example-interface-module {
   yang-version 1.1;
   namespace "urn:example:interface-module";
   prefix "if";

   container interfaces {
     list interface {
       key "name";
       leaf name {
         type string;
       }
       notification interface-enabled {
         leaf by-user {
           type string;
         }
       }
     }
   }
 }

A corresponding XML instance example of the complete notification: 完整通知的相应XML实例示例:

 <notification
   xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
   <eventTime>2008-07-08T00:01:00Z</eventTime>
   <interfaces xmlns="urn:example:interface-module">
     <interface>
       <name>eth1</name>
       <interface-enabled>
         <by-user>fred</by-user>
       </interface-enabled>
     </interface>
   </interfaces>
 </notification>

My question is, when I raise a notification from server, I thought the notification content would be this : 我的问题是,当我从服务器发出通知时,我认为通知内容将是这样的:

<notification
   xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
   <eventTime>2008-07-08T00:01:00Z</eventTime>
   <interface-enabled xmlns="urn:example:interface-module">
      <by-user>fred</by-user>
   </interface-enabled>
 </notification>

But, such a notification will be useless without identifying the data node for which the notification is relevant. 但是,这样的通知在没有标识与通知有关的数据节点的情况下将是无用的。

I guess my question is, what rule/text in the spec tells me how to form the payload correctly 我想我的问题是,规范中的什么规则/文字告诉我如何正确形成有效载荷

https://tools.ietf.org/html/rfc7950#section-7.16.2 https://tools.ietf.org/html/rfc7950#section-7.16.2

When a notification node is defined as a child to a data node, the element defined in [RFC5277] contains a hierarchy of nodes that identifies the node in the datastore. 当通知节点被定义为数据节点的子级时,[RFC5277]中定义的元素包含标识数据存储中节点的节点层次结构。 It MUST contain all containers and list nodes from the top level down to the list or container containing the notification . 它必须包含从顶层到包含通知的列表或容器的所有容器和列表节点

The notification payload must include all ancestor container/lists up to the module root. 通知有效负载必须包括所有祖先容器/列表,直到模块根目录为止。 Only then it is always possible to identify the exact node to which the notification is referring. 只有这样,始终可以确定通知所引用的确切节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM