Simple tutorial YANG NETCONF Yang Modules and submodules
Simple tutorial YANG & NETCONF
Yang - Modules and submodules � Header statements �yang-version, namespace, prefix � Linkage statement �import and include � Meta information �organization, contact � Revision �revision history
Yang - Modules and submodules module besip-module { namespace "besip"; prefix acme; import “my-types" { prefix mt; } include “some-submodule"; organization “Besip Inc. "; contact joe@mail. com; description “Example module"; revision 2011 -08 -15 { description "Initial revision. "; } … }
Yang - Statements � basic �leaf-list �container �list � special �must �when �augment
Yang - Types � Integral � {, u}int{8, 16, 32, 64} � String � string, enumeration, boolean � Binary data � binary � Bit fields �bits � References �instance-identifier, keyref � Other �typedef, union, grouping
Yang - Example YANG NETCONF list user { key name; leaf name { type string; } leaf uid { type uint 32; } leaf full-name { type string; } leaf class { type string; default viewer; } } <user> <name>glocks</name> <full-name>Goldie</full-name> <class>intruder</class> </user> <name>snowey</name> <full-name>Snow</full-name> <class>free-loader</class> </user> <name>rzull</name> <full-name>Repun</full-name> </user>
Yang - RPC YANG rpc activate { input { leaf input. Text { type string; } } output { leaf status { type string; } } } NETCONF <rpc xmlns="urn: mumble"> <activate> <input. Text> some text </input. Text> </activate> </rpc> <rpc-reply> <activate> <status> current status </status> </activate> </rpc>
Netconf � � � � netconfd program is a NETCONF-over-SSH server implementation driven directly by YANG files robust and secure database interface using standard NETCONF protocol operations Supports <candidate>, <running>, and <startup> databases support for database locking, editing, validation subtree and full XPath filtering Complete XML 1. 0 implementation with full support for XML Namespaces
Netconf – DBs (XML document)
Netconf - Session � Start session � Exchanging <hello> tag elements <hello> <capabilities> <capability>first-capability</capability> <!- - tag elements for additional capabilities - -> </capabilities> </hello> � End session <close-session> <kill-session>
Netconf - Requests � Operation requests <rpc> <get-interface-information> <interface-name>ge-2/3/0</interface-name> <detail/> </get-interface-information> </rpc> <rpc-reply xmlns="URN" xmlns: junos="URL"> <ok/> </rpc-reply>
Netconf - Requests � Configuration requests – get config <rpc> <get-config> <source> <candidate/> </source> <filter type="subtree"> <configuration> <system> <login/> </system> </configuration> </filter> </get-config> </rpc>
Netconf - Requests � Configuration requests – edit config <rpc> <edit-config> <target> <candidate/> </target> <configuration> <system> <login> <user> <name>admin</name> <full-name>Administrator</full-name> <class>superuser</class> </user> </login> </system> </configuration> </config> </edit-config> </rpc>
Netconf - Operations � � � <get> Retrieve <running> or state data. <get-config> Retrieve all or part of a configuration. <edit-config> Edit the target configuration. <copy-config> Copy an entire configuration. <delete-config> Delete a configuration. <commit> Activate edits in <candidate>. <cancel-commit> Cancel a confirmed-commit operation. <discard-changes> Discard edits in <candidate>. <load> Load a YANG module. <get-schema> Retrieve a YANG or YIN module definition file. <create-subscription> Start receiving notifications.
Netconf - Operations � � � <lock> Lock a database. <unlock> Unlock a database. <partial-lock> Lock part of the <running> database. <partial-unlock> Unlock part of the <running> database. <validate> Validate a database. <get-my-session> Retrieve session customization parameters. <close-session> Terminate the current session. <kill-session> Terminate a NETCONF session. <set-my-session> Set the session customization parameters. <set-log-level> Set the logging verbosity level. <restart> Restart the server. <shutdown> Shutdown the server.
- Slides: 15