180 likes | 858 Views
Simple tutorial. Yang & Netconf. Yang - M odules and submodules. Header statements yang-version, namespace, prefix Linkage statement import and include Meta information organization, contact Revision history revision. Yang - M odules and submodules. module besip-module {
E N D
Simple tutorial Yang & Netconf
Yang - Modulesand submodules • Header statements • yang-version, namespace, prefix • Linkage statement • import and include • Meta information • organization, contact • Revision history • revision
Yang - Modules and submodules module besip-module{ namespace "besip"; prefix acme; import “my-types" { prefix mt; } include “some-submodule"; organization “BesipInc."; contact joe@mail.com; description “Example module"; revision 2011-08-15 { description "Initial revision."; } … }
Yang - Statements • basic • leaf • 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 NETCONF <user> <name>glocks</name> <full-name>Goldie</full-name> <class>intruder</class> </user> <user> <name>snowey</name> <full-name>Snow</full-name> <class>free-loader</class> </user> <user> <name>rzull</name> <full-name>Repun</full-name> </user> YANG list user { key name; leaf name { type string; } leaf uid { type uint32; } leaf full-name { type string; } leaf class { type string; default viewer; } }
Yang - RPC NETCONF <rpcxmlns="urn:mumble"> <activate> <inputText>some text </inputText> </activate> </rpc> <rpc-reply> <activate> <status> current status </status> </activate> </rpc> YANG rpc activate { input { leaf inputText{ type string; } } output { leaf status { type string; } } }
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 • subtreeand full XPathfiltering • Complete XML 1.0 implementation with full support for XML Namespaces
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> <config> <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.