${xml_data}= Resolve_Xml_Data_From_Template_Folder ${folder} ${mapping_as_string}
Post_Xml_Via_Restconf ${uri_part} ${xml_data}
+Post_Json_Via_Restconf
+ [Arguments] ${uri_part} ${json_data}
+ [Documentation] Post JSON data to given controller-config URI, check reponse text is empty and status_code is 204.
+ BuiltIn.Log ${uri_part}
+ BuiltIn.Log ${json_data}
+ # As seen in previous two Keywords, Post does not need long specific URI.
+ # But during Lithium development, Post ceased to do merge, so those Keywords do not work anymore.
+ # This Keyword can still be used with specific URI to create a new container and fail if a container was already present.
+ ${response}= RequestsLibrary.Post ${NetconfViaRestconf__active_config_session} ${uri_part} data=${json_data} headers=${HEADERS_YANG_JSON}
+ BuiltIn.Log ${response.text}
+ BuiltIn.Should_Be_Empty ${response.text}
+ BuiltIn.Should_Be_Equal_As_Strings ${response.status_code} 204
+
+Post_Json_Template_Folder_Via_Restconf
+ [Arguments] ${folder} ${mapping_as_string}={}
+ [Documentation] Resolve URI and data from folder, POST to restconf.
+ ${uri_part}= Resolve_URI_From_Template_Folder ${folder} ${mapping_as_string}
+ ${json_data}= Resolve_Json_Data_From_Template_Folder ${folder} ${mapping_as_string}
+ Post_Json_Via_Restconf ${uri_part} ${json_data}
+
Put_Xml_Via_Restconf
[Arguments] ${uri_part} ${xml_data}
[Documentation] Put XML data to given controller-config URI, check reponse text is empty and status_code is one of allowed ones.
...
... Perform basic operations (Create, Read, Update and Delete or CRUD) on device
... data mounted onto a netconf connector and see if they work.
+...
+... FIXME: Replace the BuiltIn.Should_[Not_]Contain instances in the test cases
+... that check the car list related data with calls to keywords of a Resource
+... aimed at getting interesting pieces of data from the XML files and checking
+... them against expected data sets. See MDSAL/northbound.robot suite for
+... additional information.
Suite Setup Setup_Everything
Suite Teardown Teardown_Everything
Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
[Documentation] Get the device data and make sure it is empty.
Check_Config_Data <data xmlns="${ODL_NETCONF_NAMESPACE}"></data>
-Create_Device_Data
- [Documentation] Send some sample test data into the device and check that the request went OK.
+Create_Device_Data_Label_Via_Xml
+ [Documentation] Send a sample test data label into the device and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}dataorig ${template_as_string}
-Check_Device_Data_Is_Created
- [Documentation] Get the device data and make sure it contains the created content.
+Check_Device_Data_Label_Is_Created
+ [Documentation] Get the device data label and make sure it contains the created content.
Check_Config_Data <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Content</l></cont></data>
-Modify_Device_Data
- [Documentation] Send a request to change the sample test data and check that the request went OK.
+Modify_Device_Data_Label_Via_Xml
+ [Documentation] Send a request to change the sample test data label and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
NetconfViaRestconf.Put_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}datamod1 ${template_as_string}
-Check_Device_Data_Is_Modified
- [Documentation] Get the device data and make sure it contains the created content.
+Check_Device_Data_Label_Is_Modified
+ [Documentation] Get the device data label and make sure it contains the modified content.
Check_Config_Data <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Modified Content</l></cont></data>
-Modify_Device_Data_Via_JSON
- [Documentation] Send a JSON request to change the sample test data and check that the request went OK.
+Modify_Device_Data_Label_Via_Json
+ [Documentation] Send a JSON request to change the sample test data label and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
NetconfViaRestconf.Put_Json_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}datamodjson ${template_as_string}
-Check_Device_Data_Is_Modified_Via_JSON
- [Documentation] Get the device data as XML and make sure it matches the content posted as JSON in the previous case.
+Check_Device_Data_Label_Is_Modified_Via_Json
+ [Documentation] Get the device data label as XML and make sure it matches the content posted as JSON in the previous case.
Check_Config_Data <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Content Modified via JSON</l></cont></data>
+Create_Car_List
+ [Documentation] Send a request to create a list of cars in the sample test data label and check that the request went OK.
+ ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
+ NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars ${template_as_string}
+
+Check_Car_List_Created
+ [Documentation] Get the device data label as XML and make sure it matches the content posted as JSON in the previous case.
+ ${data}= Get_Config_Data
+ BuiltIn.Should_Contain ${data} <id>KEEP</id>
+ BuiltIn.Should_Not_Contain ${data} <id>SMALL</id>
+ BuiltIn.Should_Not_Contain ${data} <model>Isetta</model>
+ BuiltIn.Should_Not_Contain ${data} <manufacturer>BMW</manufacturer>
+ BuiltIn.Should_Not_Contain ${data} <year>1953</year>
+ BuiltIn.Should_Not_Contain ${data} <category>microcar</category>
+ BuiltIn.Should_Not_Contain ${data} <id>TOYOTA</id>
+ BuiltIn.Should_Not_Contain ${data} <model>Camry</model>
+ BuiltIn.Should_Not_Contain ${data} <manufacturer>Toyota</manufacturer>
+ BuiltIn.Should_Not_Contain ${data} <year>1982</year>
+ BuiltIn.Should_Not_Contain ${data} <category>sedan</category>
+
+Add_Device_Data_Item_1_Via_XML_Post
+ [Documentation] Send a request to create a data item in the test list and check that the request went OK.
+ ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
+ NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}item1 ${template_as_string}
+
+Check_Item1_Is_Created
+ [Documentation] Get the device data as XML and make sure it matches the content posted as JSON in the previous case.
+ ${data}= Get_Config_Data
+ BuiltIn.Should_Contain ${data} <id>SMALL</id>
+ BuiltIn.Should_Contain ${data} <model>Isetta</model>
+ BuiltIn.Should_Contain ${data} <manufacturer>BMW</manufacturer>
+ BuiltIn.Should_Contain ${data} <year>1953</year>
+ BuiltIn.Should_Contain ${data} <category>microcar</category>
+ BuiltIn.Should_Not_Contain ${data} <id>TOYOTA</id>
+ BuiltIn.Should_Not_Contain ${data} <model>Camry</model>
+ BuiltIn.Should_Not_Contain ${data} <manufacturer>Toyota</manufacturer>
+ BuiltIn.Should_Not_Contain ${data} <year>1982</year>
+ BuiltIn.Should_Not_Contain ${data} <category>sedan</category>
+
+Add_Device_Data_Item_2_Via_JSON_Post
+ [Documentation] Send a JSON request to change the sample test data and check that the request went OK.
+ ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
+ NetconfViaRestconf.Post_Json_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}item2 ${template_as_string}
+
+Check_Item2_Is_Created
+ [Documentation] Get the device data as XML and make sure it matches the content posted as JSON in the previous case.
+ ${data}= Get_Config_Data
+ BuiltIn.Should_Contain ${data} <id>SMALL</id>
+ BuiltIn.Should_Contain ${data} <model>Isetta</model>
+ BuiltIn.Should_Contain ${data} <manufacturer>BMW</manufacturer>
+ BuiltIn.Should_Contain ${data} <year>1953</year>
+ BuiltIn.Should_Contain ${data} <category>microcar</category>
+ BuiltIn.Should_Contain ${data} <id>TOYOTA</id>
+ BuiltIn.Should_Contain ${data} <model>Camry</model>
+ BuiltIn.Should_Contain ${data} <manufacturer>Toyota</manufacturer>
+ BuiltIn.Should_Contain ${data} <year>1982</year>
+ BuiltIn.Should_Contain ${data} <category>sedan</category>
+
Delete_Device_Data
[Documentation] Send a request to delete the sample test data on the device and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}datamod1 ${template_as_string}
+ NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}item1 ${template_as_string}
Check_Device_Data_Is_Deleted
[Documentation] Get the device data and make sure it is empty again.
RequestsLibrary.Delete_All_Sessions
BuiltIn.Run_Keyword_And_Ignore_Error NetconfKeywords.Stop_Testtool
-Check_Config_Data
- [Arguments] ${expected} ${contains}=False
+Get_Config_Data
+ [Documentation] Get and return the config data from the device.
${url}= Builtin.Set_Variable network-topology:network-topology/topology/topology-netconf/node/${device_name}/yang-ext:mount
${data}= Utils.Get_Data_From_URI nvr_session ${url} headers=${ACCEPT_XML}
+ [Return] ${data}
+
+Check_Config_Data
+ [Arguments] ${expected} ${contains}=False
+ ${data}= Get_Config_Data
BuiltIn.Run_Keyword_Unless ${contains} BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
BuiltIn.Run_Keyword_If ${contains} BuiltIn.Should_Contain ${data} ${expected}
--- /dev/null
+network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount
--- /dev/null
+<cars xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car">
+ <car-entry>
+ <id>KEEP</id>
+ </car-entry>
+</cars>
--- /dev/null
+network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
--- /dev/null
+<cont xmlns="urn:opendaylight:test:netconf:crud">
+<l>Another Modified Content</l>
+</cont>
--- /dev/null
+network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
--- /dev/null
+<cont xmlns="urn:opendaylight:test:netconf:crud">
+<l>Another Modified Content</l>
+<car />
+</cont>
--- /dev/null
+{
+ "test:cont": {
+ "l":"Content"
+ }
+}
--- /dev/null
+network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/car:cars
--- /dev/null
+<car-entry xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car">
+ <id>SMALL</id>
+ <model>Isetta</model>
+ <manufacturer>BMW</manufacturer>
+ <year>1953</year>
+ <category>microcar</category>
+</car-entry>
--- /dev/null
+network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/car:cars
--- /dev/null
+{
+ "car:car-entry": {
+ "car:id":"TOYOTA",
+ "car:model":"Camry",
+ "car:manufacturer":"Toyota",
+ "car:year":"1982",
+ "car:category":"sedan"
+ }
+}
--- /dev/null
+module car-people {
+
+ yang-version 1;
+
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-people";
+
+ prefix car;
+
+ import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+ import car { prefix "c"; revision-date 2014-08-18; }
+ import people { prefix "people"; revision-date 2014-08-18; }
+
+ organization "Netconf Central";
+
+ contact
+ "Harman Singh <harmasin@cisco.com>";
+
+ description
+ "YANG model for car for test application";
+
+ revision "2014-08-18" {
+ description
+ "Clustering sample app";
+ }
+
+ container car-people {
+ description
+ "Top-level container for all people car map";
+
+ list car-person {
+ key "car-id person-id";
+ description "A mapping of cars and people.";
+ leaf car-id {
+ type c:car-id;
+ }
+
+ leaf person-id {
+ type people:person-id;
+ }
+ }
+ }
+}
--- /dev/null
+module car-purchase {
+
+ yang-version 1;
+
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-purchase";
+
+ prefix cp;
+
+ import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+ import car { prefix "car"; revision-date 2014-08-18; }
+ import people { prefix "person"; revision-date 2014-08-18; }
+ import yang-ext {prefix "ext"; revision-date "2013-07-09";}
+
+ organization "Netconf Central";
+
+ contact
+ "Harman Singh <harmasin@cisco.com>";
+
+ description
+ "YANG model for car purchase for test application";
+
+ revision "2014-08-18" {
+ description
+ "Clustering sample app";
+ }
+
+ rpc buy-car {
+ description
+ "buy a new car";
+ input {
+ leaf person {
+ ext:context-reference "person:person-context";
+ type person:person-ref;
+ description "A reference to a particular person.";
+ }
+
+ leaf car-id {
+ type car:car-id;
+ description "identifier of car.";
+ }
+ leaf person-id {
+ type person:person-id;
+ description "identifier of person.";
+ }
+ }
+ }
+
+ notification carBought {
+ description
+ "Indicates that a person bought a car.";
+ leaf car-id {
+ type car:car-id;
+ description "identifier of car.";
+ }
+ leaf person-id {
+ type person:person-id;
+ description "identifier of person.";
+ }
+ }
+}
--- /dev/null
+module car {
+
+ yang-version 1;
+
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car";
+
+ prefix car;
+
+ import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+
+ organization "Netconf Central";
+
+ contact
+ "Harman Singh <harmasin@cisco.com>";
+
+ description
+ "YANG model for car for test application";
+
+ revision "2014-08-18" {
+ description
+ "Clustering sample app";
+ }
+
+ typedef car-id {
+ type inet:uri;
+ description "An identifier for car entry.";
+ }
+
+ grouping car-entry {
+ description "Describes the contents of a car entry -
+ Details of the car manufacturer, model etc";
+ leaf id {
+ type car-id;
+ description "identifier of single list of entries.";
+ }
+
+ leaf model {
+ type string;
+ }
+ leaf manufacturer {
+ type string;
+ }
+
+ leaf year {
+ type uint32;
+ }
+
+ leaf category {
+ type string;
+ }
+ }
+
+ container cars {
+ description
+ "Top-level container for all car objects.";
+ list car-entry {
+ key "id";
+ description "A list of cars (as defined by the 'grouping car-entry').";
+ uses car-entry;
+ }
+ }
+
+ rpc stress-test {
+ input {
+ leaf rate {
+ type uint16;
+ }
+
+ leaf count {
+ type uint16;
+ default 0;
+ description "Number of cars to create. Zero implies unlimited cars; use
+ stop-stress-test rpc to stop the test.";
+ }
+ }
+ }
+
+ rpc stop-stress-test {
+
+ }
+
+ rpc register-ownership {
+ input {
+ leaf car-id {
+ type string;
+ }
+ }
+ }
+
+ rpc unregister-ownership {
+ input {
+ leaf car-id {
+ type string;
+ }
+ }
+ }
+}
--- /dev/null
+ module ietf-inet-types {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+ prefix "inet";
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+
+ WG Chair: David Partain
+ <mailto:david.partain@ericsson.com>
+
+ WG Chair: David Kessens
+ <mailto:david.kessens@nsn.com>
+
+ Editor: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>";
+
+ description
+ "This module contains a collection of generally useful derived
+ YANG data types for Internet addresses and related things.
+
+ Copyright (c) 2010 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, is permitted pursuant to, and subject to the license
+ terms contained in, the Simplified BSD License set forth in Section
+ 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC 6021; see
+ the RFC itself for full legal notices.";
+
+ revision 2010-09-24 {
+ description
+ "Initial revision.";
+ reference
+ "RFC 6021: Common YANG Data Types";
+ }
+
+ /*** collection of protocol field related types ***/
+
+ typedef ip-version {
+ type enumeration {
+ enum unknown {
+ value "0";
+ description
+ "An unknown or unspecified version of the Internet protocol.";
+ }
+ enum ipv4 {
+ value "1";
+ description
+ "The IPv4 protocol as defined in RFC 791.";
+ }
+ enum ipv6 {
+ value "2";
+ description
+ "The IPv6 protocol as defined in RFC 2460.";
+ }
+ }
+ description
+ "This value represents the version of the IP protocol.
+
+ In the value set and its semantics, this type is equivalent
+ to the InetVersion textual convention of the SMIv2.";
+ reference
+ "RFC 791: Internet Protocol
+ RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+ RFC 4001: Textual Conventions for Internet Network Addresses";
+ }
+
+ typedef dscp {
+ type uint8 {
+ range "0..63";
+ }
+ description
+ "The dscp type represents a Differentiated Services Code-Point
+ that may be used for marking packets in a traffic stream.
+
+ In the value set and its semantics, this type is equivalent
+ to the Dscp textual convention of the SMIv2.";
+ reference
+ "RFC 3289: Management Information Base for the Differentiated
+ Services Architecture
+ RFC 2474: Definition of the Differentiated Services Field
+ (DS Field) in the IPv4 and IPv6 Headers
+ RFC 2780: IANA Allocation Guidelines For Values In
+ the Internet Protocol and Related Headers";
+ }
+
+ typedef ipv6-flow-label {
+ type uint32 {
+ range "0..1048575";
+ }
+ description
+ "The flow-label type represents flow identifier or Flow Label
+ in an IPv6 packet header that may be used to discriminate
+ traffic flows.
+
+ In the value set and its semantics, this type is equivalent
+ to the IPv6FlowLabel textual convention of the SMIv2.";
+ reference
+ "RFC 3595: Textual Conventions for IPv6 Flow Label
+ RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
+ }
+
+ typedef port-number {
+ type uint16 {
+ range "0..65535";
+ }
+ description
+ "The port-number type represents a 16-bit port number of an
+ Internet transport layer protocol such as UDP, TCP, DCCP, or
+ SCTP. Port numbers are assigned by IANA. A current list of
+ all assignments is available from <http://www.iana.org/>.
+
+ Note that the port number value zero is reserved by IANA. In
+ situations where the value zero does not make sense, it can
+ be excluded by subtyping the port-number type.
+
+ In the value set and its semantics, this type is equivalent
+ to the InetPortNumber textual convention of the SMIv2.";
+ reference
+ "RFC 768: User Datagram Protocol
+ RFC 793: Transmission Control Protocol
+ RFC 4960: Stream Control Transmission Protocol
+ RFC 4340: Datagram Congestion Control Protocol (DCCP)
+ RFC 4001: Textual Conventions for Internet Network Addresses";
+ }
+
+ /*** collection of autonomous system related types ***/
+
+ typedef as-number {
+ type uint32;
+ description
+ "The as-number type represents autonomous system numbers
+ which identify an Autonomous System (AS). An AS is a set
+ of routers under a single technical administration, using
+ an interior gateway protocol and common metrics to route
+ packets within the AS, and using an exterior gateway
+ protocol to route packets to other ASs'. IANA maintains
+ the AS number space and has delegated large parts to the
+ regional registries.
+
+ Autonomous system numbers were originally limited to 16
+ bits. BGP extensions have enlarged the autonomous system
+ number space to 32 bits. This type therefore uses an uint32
+ base type without a range restriction in order to support
+ a larger autonomous system number space.
+
+ In the value set and its semantics, this type is equivalent
+ to the InetAutonomousSystemNumber textual convention of
+ the SMIv2.";
+ reference
+ "RFC 1930: Guidelines for creation, selection, and registration
+ of an Autonomous System (AS)
+ RFC 4271: A Border Gateway Protocol 4 (BGP-4)
+ RFC 4893: BGP Support for Four-octet AS Number Space
+ RFC 4001: Textual Conventions for Internet Network Addresses";
+ }
+
+ /*** collection of IP address and hostname related types ***/
+
+ typedef ip-address {
+ type union {
+ type inet:ipv4-address;
+ type inet:ipv6-address;
+ }
+ description
+ "The ip-address type represents an IP address and is IP
+ version neutral. The format of the textual representations
+ implies the IP version.";
+ }
+
+ typedef ipv4-address {
+ type string {
+ pattern
+ '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+ + '(%[\p{N}\p{L}]+)?';
+ }
+ description
+ "The ipv4-address type represents an IPv4 address in
+ dotted-quad notation. The IPv4 address may include a zone
+ index, separated by a % sign.
+
+ The zone index is used to disambiguate identical address
+ values. For link-local addresses, the zone index will
+ typically be the interface index number or the name of an
+ interface. If the zone index is not present, the default
+ zone of the device will be used.
+
+ The canonical format for the zone index is the numerical
+ format";
+ }
+
+ typedef ipv6-address {
+ type string {
+ pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+ + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+ + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+ + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+ + '(%[\p{N}\p{L}]+)?';
+ pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+ + '(%.+)?';
+ }
+ description
+ "The ipv6-address type represents an IPv6 address in full,
+ mixed, shortened, and shortened-mixed notation. The IPv6
+ address may include a zone index, separated by a % sign.
+
+ The zone index is used to disambiguate identical address
+ values. For link-local addresses, the zone index will
+ typically be the interface index number or the name of an
+ interface. If the zone index is not present, the default
+ zone of the device will be used.
+
+ The canonical format of IPv6 addresses uses the compressed
+ format described in RFC 4291, Section 2.2, item 2 with the
+ following additional rules: the :: substitution must be
+ applied to the longest sequence of all-zero 16-bit chunks
+ in an IPv6 address. If there is a tie, the first sequence
+ of all-zero 16-bit chunks is replaced by ::. Single
+ all-zero 16-bit chunks are not compressed. The canonical
+ format uses lowercase characters and leading zeros are
+ not allowed. The canonical format for the zone index is
+ the numerical format as described in RFC 4007, Section
+ 11.2.";
+ reference
+ "RFC 4291: IP Version 6 Addressing Architecture
+ RFC 4007: IPv6 Scoped Address Architecture
+ RFC 5952: A Recommendation for IPv6 Address Text Representation";
+ }
+
+ typedef ip-prefix {
+ type union {
+ type inet:ipv4-prefix;
+ type inet:ipv6-prefix;
+ }
+ description
+ "The ip-prefix type represents an IP prefix and is IP
+ version neutral. The format of the textual representations
+ implies the IP version.";
+ }
+
+ typedef ipv4-prefix {
+ type string {
+ pattern
+ '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+ + '/(([0-9])|([1-2][0-9])|(3[0-2]))';
+ }
+ description
+ "The ipv4-prefix type represents an IPv4 address prefix.
+ The prefix length is given by the number following the
+ slash character and must be less than or equal to 32.
+
+ A prefix length value of n corresponds to an IP address
+ mask that has n contiguous 1-bits from the most
+ significant bit (MSB) and all other bits set to 0.
+
+ The canonical format of an IPv4 prefix has all bits of
+ the IPv4 address set to zero that are not part of the
+ IPv4 prefix.";
+ }
+
+ typedef ipv6-prefix {
+ type string {
+ pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+ + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+ + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+ + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+ + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
+ pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+ + '(/.+)';
+ }
+ description
+ "The ipv6-prefix type represents an IPv6 address prefix.
+ The prefix length is given by the number following the
+ slash character and must be less than or equal 128.
+
+ A prefix length value of n corresponds to an IP address
+ mask that has n contiguous 1-bits from the most
+ significant bit (MSB) and all other bits set to 0.
+
+ The IPv6 address should have all bits that do not belong
+ to the prefix set to zero.
+
+ The canonical format of an IPv6 prefix has all bits of
+ the IPv6 address set to zero that are not part of the
+ IPv6 prefix. Furthermore, IPv6 address is represented
+ in the compressed format described in RFC 4291, Section
+ 2.2, item 2 with the following additional rules: the ::
+ substitution must be applied to the longest sequence of
+ all-zero 16-bit chunks in an IPv6 address. If there is
+ a tie, the first sequence of all-zero 16-bit chunks is
+ replaced by ::. Single all-zero 16-bit chunks are not
+ compressed. The canonical format uses lowercase
+ characters and leading zeros are not allowed.";
+ reference
+ "RFC 4291: IP Version 6 Addressing Architecture";
+ }
+
+ /*** collection of domain name and URI types ***/
+
+ typedef domain-name {
+ type string {
+ pattern '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
+ + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
+ + '|\.';
+ length "1..253";
+ }
+ description
+ "The domain-name type represents a DNS domain name. The
+ name SHOULD be fully qualified whenever possible.
+
+ Internet domain names are only loosely specified. Section
+ 3.5 of RFC 1034 recommends a syntax (modified in Section
+ 2.1 of RFC 1123). The pattern above is intended to allow
+ for current practice in domain name use, and some possible
+ future expansion. It is designed to hold various types of
+ domain names, including names used for A or AAAA records
+ (host names) and other records, such as SRV records. Note
+ that Internet host names have a stricter syntax (described
+ in RFC 952) than the DNS recommendations in RFCs 1034 and
+ 1123, and that systems that want to store host names in
+ schema nodes using the domain-name type are recommended to
+ adhere to this stricter standard to ensure interoperability.
+
+ The encoding of DNS names in the DNS protocol is limited
+ to 255 characters. Since the encoding consists of labels
+ prefixed by a length bytes and there is a trailing NULL
+ byte, only 253 characters can appear in the textual dotted
+ notation.
+
+ The description clause of schema nodes using the domain-name
+ type MUST describe when and how these names are resolved to
+ IP addresses. Note that the resolution of a domain-name value
+ may require to query multiple DNS records (e.g., A for IPv4
+ and AAAA for IPv6). The order of the resolution process and
+ which DNS record takes precedence can either be defined
+ explicitely or it may depend on the configuration of the
+ resolver.
+
+ Domain-name values use the US-ASCII encoding. Their canonical
+ format uses lowercase US-ASCII characters. Internationalized
+ domain names MUST be encoded in punycode as described in RFC
+ 3492";
+ reference
+ "RFC 952: DoD Internet Host Table Specification
+ RFC 1034: Domain Names - Concepts and Facilities
+ RFC 1123: Requirements for Internet Hosts -- Application
+ and Support
+ RFC 2782: A DNS RR for specifying the location of services
+ (DNS SRV)
+ RFC 3492: Punycode: A Bootstring encoding of Unicode for
+ Internationalized Domain Names in Applications
+ (IDNA)
+ RFC 5891: Internationalizing Domain Names in Applications
+ (IDNA): Protocol";
+ }
+
+ typedef host {
+ type union {
+ type inet:ip-address;
+ type inet:domain-name;
+ }
+ description
+ "The host type represents either an IP address or a DNS
+ domain name.";
+ }
+
+ typedef uri {
+ type string;
+ description
+ "The uri type represents a Uniform Resource Identifier
+ (URI) as defined by STD 66.
+
+ Objects using the uri type MUST be in US-ASCII encoding,
+ and MUST be normalized as described by RFC 3986 Sections
+ 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
+ percent-encoding is removed, and all case-insensitive
+ characters are set to lowercase except for hexadecimal
+ digits, which are normalized to uppercase as described in
+ Section 6.2.2.1.
+
+ The purpose of this normalization is to help provide
+ unique URIs. Note that this normalization is not
+ sufficient to provide uniqueness. Two URIs that are
+ textually distinct after this normalization may still be
+ equivalent.
+
+ Objects using the uri type may restrict the schemes that
+ they permit. For example, 'data:' and 'urn:' schemes
+ might not be appropriate.
+
+ A zero-length URI is not a valid URI. This can be used to
+ express 'URI absent' where required.
+
+ In the value set and its semantics, this type is equivalent
+ to the Uri SMIv2 textual convention defined in RFC 5017.";
+ reference
+ "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+ RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
+ Group: Uniform Resource Identifiers (URIs), URLs,
+ and Uniform Resource Names (URNs): Clarifications
+ and Recommendations
+ RFC 5017: MIB Textual Conventions for Uniform Resource
+ Identifiers (URIs)";
+ }
+
+ }
--- /dev/null
+module ietf-netconf-monitoring-extension {
+
+ yang-version 1;
+
+ namespace
+ "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring-extension";
+
+ prefix ncme;
+
+ import ietf-netconf-monitoring {
+ prefix ncm;
+ }
+
+ revision "2013-12-10" {
+ description "Initial revision.";
+
+ }
+
+ identity netconf-tcp {
+ base ncm:transport;
+ description
+ "NETCONF over TCP.";
+ }
+
+ augment "/ncm:netconf-state/ncm:sessions/ncm:session" {
+ leaf session-identifier {
+ type string;
+ }
+ }
+
+}
--- /dev/null
+module ietf-netconf-monitoring {
+
+ yang-version 1;
+
+ namespace
+ "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring";
+
+ prefix ncm;
+
+ import ietf-yang-types {
+ prefix yang;
+ }
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ organization
+ "IETF NETCONF (Network Configuration) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+
+ WG Chair: Mehmet Ersue
+ <mailto:mehmet.ersue@nsn.com>
+
+ WG Chair: Bert Wijnen
+ <mailto:bertietf@bwijnen.net>
+
+ Editor: Mark Scott
+ <mailto:mark.scott@ericsson.com>
+
+ Editor: Martin Bjorklund
+ <mailto:mbj@tail-f.com>";
+
+ description
+ "NETCONF Monitoring Module.
+ All elements in this module are read-only.
+
+ Copyright (c) 2010 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD
+ License set forth in Section 4.c of the IETF Trust's
+ Legal Provisions Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+
+ This version of this YANG module is part of RFC 6022; see
+ the RFC itself for full legal notices.";
+
+ revision "2010-10-04" {
+ description "Initial revision.";
+ reference
+ "RFC 6022: YANG Module for NETCONF Monitoring";
+
+ }
+
+
+ typedef netconf-datastore-type {
+ type enumeration {
+ enum "running" {
+ value 0;
+ }
+ enum "candidate" {
+ value 1;
+ }
+ enum "startup" {
+ value 2;
+ }
+ }
+ description
+ "Enumeration of possible NETCONF datastore types.";
+ reference
+ "RFC 4741: NETCONF Configuration Protocol";
+
+ }
+
+ identity transport {
+ description
+ "Base identity for NETCONF transport types.";
+ }
+
+ identity netconf-ssh {
+ base transport;
+ description
+ "NETCONF over Secure Shell (SSH).";
+ reference
+ "RFC 4742: Using the NETCONF Configuration Protocol
+ over Secure SHell (SSH)";
+
+ }
+
+ identity netconf-soap-over-beep {
+ base transport;
+ description
+ "NETCONF over Simple Object Access Protocol (SOAP) over
+ Blocks Extensible Exchange Protocol (BEEP).";
+ reference
+ "RFC 4743: Using NETCONF over the Simple Object
+ Access Protocol (SOAP)";
+
+ }
+
+ identity netconf-soap-over-https {
+ base transport;
+ description
+ "NETCONF over Simple Object Access Protocol (SOAP)
+ over Hypertext Transfer Protocol Secure (HTTPS).";
+ reference
+ "RFC 4743: Using NETCONF over the Simple Object
+ Access Protocol (SOAP)";
+
+ }
+
+ identity netconf-beep {
+ base transport;
+ description
+ "NETCONF over Blocks Extensible Exchange Protocol (BEEP).";
+ reference
+ "RFC 4744: Using the NETCONF Protocol over the
+ Blocks Extensible Exchange Protocol (BEEP)";
+
+ }
+
+ identity netconf-tls {
+ base transport;
+ description
+ "NETCONF over Transport Layer Security (TLS).";
+ reference
+ "RFC 5539: NETCONF over Transport Layer Security (TLS)";
+
+ }
+
+ identity schema-format {
+ description
+ "Base identity for data model schema languages.";
+ }
+
+ identity xsd {
+ base schema-format;
+ description
+ "W3C XML Schema Definition.";
+ reference
+ "W3C REC REC-xmlschema-1-20041028:
+ XML Schema Part 1: Structures";
+
+ }
+
+ identity yang {
+ base schema-format;
+ description
+ "The YANG data modeling language for NETCONF.";
+ reference
+ "RFC 6020: YANG - A Data Modeling Language for the
+ Network Configuration Protocol (NETCONF)";
+
+ }
+
+ identity yin {
+ base schema-format;
+ description "The YIN syntax for YANG.";
+ reference
+ "RFC 6020: YANG - A Data Modeling Language for the
+ Network Configuration Protocol (NETCONF)";
+
+ }
+
+ identity rng {
+ base schema-format;
+ description
+ "Regular Language for XML Next Generation (RELAX NG).";
+ reference
+ "ISO/IEC 19757-2:2008: RELAX NG";
+
+ }
+
+ identity rnc {
+ base schema-format;
+ description "Relax NG Compact Syntax";
+ reference
+ "ISO/IEC 19757-2:2008: RELAX NG";
+
+ }
+
+ grouping common-counters {
+ description
+ "Counters that exist both per session, and also globally,
+ accumulated from all sessions.";
+ leaf in-rpcs {
+ type yang:zero-based-counter32;
+ description
+ "Number of correct <rpc> messages received.";
+ }
+
+ leaf in-bad-rpcs {
+ type yang:zero-based-counter32;
+ description
+ "Number of messages received when an <rpc> message was expected,
+ that were not correct <rpc> messages. This includes XML parse
+ errors and errors on the rpc layer.";
+ }
+
+ leaf out-rpc-errors {
+ type yang:zero-based-counter32;
+ description
+ "Number of <rpc-reply> messages sent that contained an
+ <rpc-error> element.";
+ }
+
+ leaf out-notifications {
+ type yang:zero-based-counter32;
+ description
+ "Number of <notification> messages sent.";
+ }
+ } // grouping common-counters
+
+ container netconf-state {
+ config false;
+ description
+ "The netconf-state container is the root of the monitoring
+ data model.";
+ container capabilities {
+ description
+ "Contains the list of NETCONF capabilities supported by the
+ server.";
+ leaf-list capability {
+ type inet:uri;
+ description
+ "List of NETCONF capabilities supported by the server.";
+ }
+ } // container capabilities
+
+ container datastores {
+ description
+ "Contains the list of NETCONF configuration datastores.";
+ list datastore {
+ key "name";
+ description
+ "List of NETCONF configuration datastores supported by
+ the NETCONF server and related information.";
+ leaf name {
+ type netconf-datastore-type;
+ description
+ "Name of the datastore associated with this list entry.";
+ }
+
+ container locks {
+ presence
+ "This container is present only if the datastore
+ is locked.";
+ description
+ "The NETCONF <lock> and <partial-lock> operations allow
+ a client to lock specific resources in a datastore. The
+ NETCONF server will prevent changes to the locked
+ resources by all sessions except the one that acquired
+ the lock(s).
+
+ Monitoring information is provided for each datastore
+ entry including details such as the session that acquired
+ the lock, the type of lock (global or partial) and the
+ list of locked resources. Multiple locks per datastore
+ are supported.";
+ grouping lock-info {
+ description
+ "Lock related parameters, common to both global and
+ partial locks.";
+ leaf locked-by-session {
+ type uint32;
+ mandatory true;
+ description
+ "The session ID of the session that has locked
+ this resource. Both a global lock and a partial
+ lock MUST contain the NETCONF session-id.
+
+ If the lock is held by a session that is not managed
+ by the NETCONF server (e.g., a CLI session), a session
+ id of 0 (zero) is reported.";
+ reference
+ "RFC 4741: NETCONF Configuration Protocol";
+
+ }
+
+ leaf locked-time {
+ type yang:date-and-time;
+ mandatory true;
+ description
+ "The date and time of when the resource was
+ locked.";
+ }
+ } // grouping lock-info
+ choice lock-type {
+ description
+ "Indicates if a global lock or a set of partial locks
+ are set.";
+ container global-lock {
+ description
+ "Present if the global lock is set.";
+ uses lock-info;
+ } // container global-lock
+ list partial-lock {
+ key "lock-id";
+ description
+ "List of partial locks.";
+ reference
+ "RFC 5717: Partial Lock Remote Procedure Call (RPC) for
+ NETCONF";
+
+ leaf lock-id {
+ type uint32;
+ description
+ "This is the lock id returned in the <partial-lock>
+ response.";
+ }
+
+ uses lock-info;
+
+ leaf-list select {
+ type yang:xpath1.0;
+ min-elements 1;
+ description
+ "The xpath expression that was used to request
+ the lock. The select expression indicates the
+ original intended scope of the lock.";
+ }
+
+ leaf-list locked-node {
+ type instance-identifier;
+ description
+ "The list of instance-identifiers (i.e., the
+ locked nodes).
+
+ The scope of the partial lock is defined by the list
+ of locked nodes.";
+ }
+ } // list partial-lock
+ } // choice lock-type
+ } // container locks
+ } // list datastore
+ } // container datastores
+
+ container schemas {
+ description
+ "Contains the list of data model schemas supported by the
+ server.";
+ list schema {
+ key "identifier version format";
+ description
+ "List of data model schemas supported by the server.";
+ leaf identifier {
+ type string;
+ description
+ "Identifier to uniquely reference the schema. The
+ identifier is used in the <get-schema> operation and may
+ be used for other purposes such as file retrieval.
+
+ For modeling languages that support or require a data
+ model name (e.g., YANG module name) the identifier MUST
+ match that name. For YANG data models, the identifier is
+ the name of the module or submodule. In other cases, an
+ identifier such as a filename MAY be used instead.";
+ }
+
+ leaf version {
+ type string;
+ description
+ "Version of the schema supported. Multiple versions MAY be
+ supported simultaneously by a NETCONF server. Each
+ version MUST be reported individually in the schema list,
+ i.e., with same identifier, possibly different location,
+ but different version.
+
+ For YANG data models, version is the value of the most
+ recent YANG 'revision' statement in the module or
+ submodule, or the empty string if no 'revision' statement
+ is present.";
+ }
+
+ leaf format {
+ type identityref {
+ base schema-format;
+ }
+ description
+ "The data modeling language the schema is written
+ in (currently xsd, yang, yin, rng, or rnc).
+ For YANG data models, 'yang' format MUST be supported and
+ 'yin' format MAY also be provided.";
+ }
+
+ leaf namespace {
+ type inet:uri;
+ mandatory true;
+ description
+ "The XML namespace defined by the data model.
+
+ For YANG data models, this is the module's namespace.
+ If the list entry describes a submodule, this field
+ contains the namespace of the module to which the
+ submodule belongs.";
+ }
+
+ leaf-list location {
+ type union {
+ type enumeration {
+ enum "NETCONF" {
+ value 0;
+ }
+ }
+ type inet:uri;
+ }
+ description
+ "One or more locations from which the schema can be
+ retrieved. This list SHOULD contain at least one
+ entry per schema.
+
+ A schema entry may be located on a remote file system
+ (e.g., reference to file system for ftp retrieval) or
+ retrieved directly from a server supporting the
+ <get-schema> operation (denoted by the value 'NETCONF').";
+ }
+ } // list schema
+ } // container schemas
+
+ container sessions {
+ description
+ "The sessions container includes session-specific data for
+ NETCONF management sessions. The session list MUST include
+ all currently active NETCONF sessions.";
+ list session {
+ key "session-id";
+ description
+ "All NETCONF sessions managed by the NETCONF server
+ MUST be reported in this list.";
+ leaf session-id {
+ type uint32 {
+ range "1..max";
+ }
+ description
+ "Unique identifier for the session. This value is the
+ NETCONF session identifier, as defined in RFC 4741.";
+ reference
+ "RFC 4741: NETCONF Configuration Protocol";
+
+ }
+
+ leaf transport {
+ type identityref {
+ base transport;
+ }
+ mandatory true;
+ description
+ "Identifies the transport for each session, e.g.,
+ 'netconf-ssh', 'netconf-soap', etc.";
+ }
+
+ leaf username {
+ type string;
+ mandatory true;
+ description
+ "The username is the client identity that was authenticated
+ by the NETCONF transport protocol. The algorithm used to
+ derive the username is NETCONF transport protocol specific
+ and in addition specific to the authentication mechanism
+ used by the NETCONF transport protocol.";
+ }
+
+ leaf source-host {
+ type inet:host;
+ description
+ "Host identifier of the NETCONF client. The value
+ returned is implementation specific (e.g., hostname,
+ IPv4 address, IPv6 address)";
+ }
+
+ leaf login-time {
+ type yang:date-and-time;
+ mandatory true;
+ description
+ "Time at the server at which the session was established.";
+ }
+
+ uses common-counters {
+ description
+ "Per-session counters. Zero based with following reset
+ behaviour:
+ - at start of a session
+ - when max value is reached";
+ }
+ } // list session
+ } // container sessions
+
+ container statistics {
+ description
+ "Statistical data pertaining to the NETCONF server.";
+ leaf netconf-start-time {
+ type yang:date-and-time;
+ description
+ "Date and time at which the management subsystem was
+ started.";
+ }
+
+ leaf in-bad-hellos {
+ type yang:zero-based-counter32;
+ description
+ "Number of sessions silently dropped because an
+ invalid <hello> message was received. This includes <hello>
+ messages with a 'session-id' attribute, bad namespace, and
+ bad capability declarations.";
+ }
+
+ leaf in-sessions {
+ type yang:zero-based-counter32;
+ description
+ "Number of sessions started. This counter is incremented
+ when a <hello> message with a <session-id> is sent.
+
+ 'in-sessions' - 'in-bad-hellos' =
+ 'number of correctly started netconf sessions'";
+ }
+
+ leaf dropped-sessions {
+ type yang:zero-based-counter32;
+ description
+ "Number of sessions that were abnormally terminated, e.g.,
+ due to idle timeout or transport close. This counter is not
+ incremented when a session is properly closed by a
+ <close-session> operation, or killed by a <kill-session>
+ operation.";
+ }
+
+ uses common-counters {
+ description
+ "Global counters, accumulated from all sessions.
+ Zero based with following reset behaviour:
+ - re-initialization of NETCONF server
+ - when max value is reached";
+ }
+ } // container statistics
+ } // container netconf-state
+
+ rpc get-schema {
+ description
+ "This operation is used to retrieve a schema from the
+ NETCONF server.
+
+ Positive Response:
+ The NETCONF server returns the requested schema.
+
+ Negative Response:
+ If requested schema does not exist, the <error-tag> is
+ 'invalid-value'.
+
+ If more than one schema matches the requested parameters, the
+ <error-tag> is 'operation-failed', and <error-app-tag> is
+ 'data-not-unique'.";
+ input {
+ leaf identifier {
+ type string;
+ mandatory true;
+ description
+ "Identifier for the schema list entry.";
+ }
+
+ leaf version {
+ type string;
+ description
+ "Version of the schema requested. If this parameter is not
+ present, and more than one version of the schema exists on
+ the server, a 'data-not-unique' error is returned, as
+ described above.";
+ }
+
+ leaf format {
+ type identityref {
+ base schema-format;
+ }
+ description
+ "The data modeling language of the schema. If this
+ parameter is not present, and more than one formats of
+ the schema exists on the server, a 'data-not-unique' error
+ is returned, as described above.";
+ }
+ }
+
+ output {
+ anyxml data {
+ description
+ "Contains the schema content.";
+ }
+ }
+ } // rpc get-schema
+} // module
--- /dev/null
+module people {
+
+ yang-version 1;
+
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:people";
+
+ prefix people;
+
+ import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
+
+ organization "Netconf Central";
+
+ contact
+ "Harman Singh <harmasin@cisco.com>";
+
+ description
+ "YANG model for person for test application";
+
+ revision "2014-08-18" {
+ description
+ "Clustering sample app";
+ }
+
+ typedef person-id {
+ type inet:uri;
+ description "An identifier for person.";
+ }
+
+ typedef person-ref {
+ type instance-identifier;
+ description "A reference that points to an people:people/person in the data tree.";
+ }
+ identity person-context {
+ description "A person-context is a classifier for person elements which allows an RPC to provide a service on behalf of a particular element in the data tree.";
+ }
+
+ grouping person {
+ description "Describes the details of the person";
+
+ leaf id {
+ type person-id;
+ description "identifier of single list of entries.";
+ }
+
+ leaf gender {
+ type string;
+ }
+
+ leaf age {
+ type uint32;
+ }
+
+ leaf address {
+ type string;
+ }
+
+ leaf contactNo {
+ type string;
+ }
+ }
+
+ container people {
+ description
+ "Top-level container for all people";
+
+ list person {
+ key "id";
+ description "A list of people (as defined by the 'grouping person').";
+ uses person;
+ }
+ }
+
+ rpc add-person {
+ description
+ "Add a person entry into database";
+ input {
+ uses person;
+ }
+ }
+}
--- /dev/null
+module yang-ext {
+ yang-version 1;
+ namespace "urn:opendaylight:yang:extension:yang-ext";
+ prefix "ext";
+
+ contact "Anton Tkacik <ttkacik@cisco.com>";
+
+ description
+ "Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html";
+
+ revision "2013-07-09" {
+ description "";
+ }
+
+ // Augmentation name
+
+ extension "augment-identifier" {
+ description
+ "YANG language extension which assigns an identifier to
+ augmentation. Augment identifier is used to identify
+ specific augment statement by name.
+
+ The identifier syntax is defined formally defined by the rule
+ 'identifier' in Section 12 of RFC 6020.
+
+ All augment identifiers defined in a namespace MUST be unique.
+ The namespace of augment identifiers is shared by module and
+ its submodules.";
+
+ /*
+ Discussion:
+ This extension allows for ease of development / debug
+ of YANG modules and it is suitable for code generation,
+ where each augment statement is nicely identified by
+ unique name instead of combination of augment target
+ and when condition.
+ */
+ argument "identifier";
+ }
+
+
+ // Context-aware RPCs
+
+ grouping rpc-context-ref {
+ description
+ "A reference to RPC context.";
+ leaf context-instance {
+ type instance-identifier;
+ description "Pointer to the context. ";
+ }
+ }
+
+ extension "rpc-context-instance" {
+ description
+ "YANG language extension which defines enclosing (parent)
+ schema node as referencable context for RPCs.
+
+ The argument is identity which is used to identify RPC context
+ type.";
+
+ argument "context-type";
+ }
+
+ extension "context-reference" {
+ argument "context-type";
+ }
+
+ extension "context-instance" {
+ argument "context-type";
+ }
+
+ extension "instance-target" {
+ argument "path";
+ }
+}