yang模型理解

來源:互聯網
上載者:User
前言

繼之前分享的幾篇文章之後,這篇文章分享自己對於YANG模型的理解。
關於其他如何搭建環境以及編寫app等等請閱讀下前幾篇文章。 一、Yang的來源

早在2003年,IETF成立了一個NETCONF工作群組,提出一種基於XML的網路設定管理協議,也就是NETCONF(Network Configuration Protocol),因為該協議的配置功能非常強大,同時兼顧監控和故障管理,安全驗證和存取控制,所以得到業界的一致認可,所以廣泛採用netconfig來配置網路。

NETCONF協議分為傳輸層、RPC層、操作層和內容層。其中,內容層是唯一沒有標準化的層,於是一種新的建模語言YANG產生了,它的目標是對NETCONF資料模型、操作進行建模,覆蓋NETCONF協議的操作層和內容層
二、Yang的基本元素 module

module是YANG的基本單元,是寫yang檔案的基本架構,包括以下幾種類型語句:
1、head語句(yang-version/namespace/prefix)
2、串連語句(import/include)、
3、元資訊(organization/contract)、
4、revision語句、
5、定義語句(container/leaf/leaf-list/grouping等等)。
YANG模組有如下的布局:

Java

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 module < module - name > { //header information yang - version statement namespace statement prefix statement   // linkage statements import statements include statements   // meta information organization statement contact statement description statement reference statement   // revision history revision statements   // module definitions other statements }

例如:
submodule

submodule是部分模組定義,用於對模組提供支援。
submodule檔案內容布局如下:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.