r1 - 2008-03-12 - 23:48:34 - DavidPartainYou are here: TWiki >  Main Web > ComparingYang

Comparing YANG to alternative approaches to Data Modeling for NETCONF

There are competing approaches in the IETF to doing data modeling for NETCONF. This page shows examples of models in four different languages. We think that this speaks for itself in terms of readability.

The DHCP Example

YANG - 3373 characters Relax-NG - 6179 characters XSD - 8330 characters Kalua - 6495 characters
module dhcp {
  namespace "http://example.com/ns/dhcp";
  prefix dhcp;

  import yang-types { prefix yang; }
  import inet-types { prefix inet; }
  import ieee-types { prefix ieee; }
  import interfaces { prefix if; }

  organization "yang-central.org";
  description "Partial data model for DHCP, based on the config of
               the ISC DHCP reference implementation.";

  container dhcp {
    description
      "configuration and operational parameters for a DHCP server.";

    leaf max-lease-time {
      type uint32;
      units seconds;
      default 7200;
    }

    leaf default-lease-time {
      type uint32;
      units seconds;
      must '$this <= ../max-lease-time' {
        error-message
          "The default-lease-time must be less than max-lease-time";
      }
      default 600;
    }

    uses subnet-list;

    container shared-networks {
      list shared-network {
        key name;
        leaf name {
          type string;
        }
        uses subnet-list;
      }
    }
  }

  grouping subnet-list {
    description "A reusable list of subnets";
    list subnet {
      key "network prefix-length";
      leaf network {
        type inet:ip-address;
      }
      leaf prefix-length {
        type uint8 {
          range "0..128";
        }
      }
      container range {
        presence "enables dynamic address assignment";
        leaf dynamic-bootp {
          type empty;
          description
            "Allows BOOTP clients to get addresses in this range";
        }
        leaf low {
          type inet:ip-address;
          mandatory true;
        }
        leaf high {
          type inet:ip-address;
          mandatory true;
        }
      }

      container dhcp-options {
        description "Options in the DHCP protocol";
        container router-list {
          leaf-list router {
            type inet:host;
            ordered-by user;
            reference "RFC 2132, sec. 3.8";
          }
        }
        container domain-list {
          leaf-list domain-name {
            type inet:domain-name;
            reference "RFC 2132, sec. 3.17";
          }
        }
        list custom {
          key option;
          leaf option {
            type uint32;
          }
          choice type {
            leaf ipv4-address {
              type inet:ipv4-address;
            }
            leaf string {
              type string;
            }
          }
        }
      }

      leaf max-lease-time {
        type uint32;
        units seconds;
        default 7200;
      }

      container leases {
        config false;
        description
          "Contains status information about active leases.";
        list lease {
          key address;

          leaf address {
            type inet:ip-address;
          }
          leaf starts {
            type yang:date-and-time;
          }
          leaf ends {
            type yang:date-and-time;
          }
          leaf mac-address {
            type yang:phys-address;
          }
        }
      }

      container interface-filter {
        description
          "The DHCP server will only respond to requests for this
           subnet when they come from one of these interfaces";
        leaf-list interface {
          type keyref {
            path "/if:interfaces/if:interface/if:ifName";
          }
        }
      }
    }
  }
}
# config-root.rnc
namespace rng = "http://relaxng.org/ns/structure/1.0"
namespace dc   = "http://purl.org/dc/terms"
namespace dml  = "http://example.org/ns/dml"
namespace compat ="http://relaxng.org/ns/compatibility/annotations/1.0"
namespace cfg  = "http://example.org/ns/cfg"

start = element-config
element-config = element cfg:config { config-contents }
config-contents = empty

config-contents &= external "interfaces.rnc" ?
config-contents &= external "dhcp.rnc" ?

# interfaces.rnc
namespace rng = "http://relaxng.org/ns/structure/1.0"
namespace xsd  = "http://www/w3/org/2001/XMLSchema-datatypes"
namespace xml  = "http://www.w3.org/XML/1998/namespace"
namespace sch  = "http://www.ascc.net/xml/schematron"
namespace dc   = "http://purl.org/dc/terms"
namespace dml  = "http://example.org/ns/dml"
namespace compat ="http://relaxng.org/ns/compatibility/annotations/1.0"
namespace int  = "http://example.org/ns/int"
default namespace = "http://example.org/ns/int"

start = element-interfaces

element-interfaces = element interfaces {
  element-interface+
  >> dc:title [ "Example Interfaces schema fragment" ]
}

element-interface = element interface {
  element ifIndex { xsd:token },
  element ifType  { xsd:token }
  >> dml:key [ "ifIndex"]
  >> dml:version ["1.0"]
}


# dhcp+extensions.rnc
namespace rng = "http://relaxng.org/ns/structure/1.0"
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"

include "dhcp.rnc"       # base module
include "dhcp-tz.rnc"    # timezone option extension
include "dhcp-wins.rnc"  # WINS server option extension

# dhcp.rnc
namespace rng = "http://relaxng.org/ns/structure/1.0"
namespace xsd  = "http://www/w3/org/2001/XMLSchema-datatypes"
namespace xml  = "http://www.w3.org/XML/1998/namespace"
namespace sch  = "http://www.ascc.net/xml/schematron"
namespace dc   = "http://purl.org/dc/terms"
namespace dml  = "http://example.org/ns/dml"
namespace dhcp = "http://example.org/ns/dhcp"
namespace int  = "http://example.org/ns/int"
namespace nt  = "http://example.org/ns/net-types"
namespace compat ="http://relaxng.org/ns/compatibility/annotations/1.0"
default namespace = "http://example.org/ns/dhcp"

include "network-types.rnc"

start = element-dhcp

element-dhcp = element dhcp {
   global-timer-elements,
   element-subnet*,
   element-shared-network*
   >> dc:title [ "Example schema for DHCP server" ]
   >> dml:version ["1.0"]
   >> dc:type ["Dataset"]
   >> dc:creator [ "Rohan Mahy" ]
   >> dml:organization [ "as an individual" ]
   >> dml:contact [ "mailto:rohan@ekabal.com" ]
   >> dc:created [ "2008-02-13" ]
}

global-timer-elements = (
  [
    sch:pattern [
      sch:rule  [
        context = "//dhcp:dhcp"
        sch:assert [
          test = "dhcp:default-lease-time <= dhcp:max-lease-time"
          "Default lease time cannot be larger than maximum lease time"
        ]
      ]
    ]
  ]
  element default-lease-time {
     xsd:unsignedInt
     >> compat:defaultValue ["3600"] >> dml:units ["s"]
  }?,
  element max-lease-time { xsd:unsignedInt
    >> dml:units ["s"] }?
)

element-shared-network = element shared-network {
   attribute name { token },
   element-subnet*
}

element-subnet = element subnet {
   element-network,
   element-prefix-length,
   element-range?,
   element-dhcp-options?,
   element max-lease-time {
      xsd:unsignedInt
      >> dml:units ["s"]
      >> dml:status ["deprecated"]
   }?,
   element leases {
      element-lease*
      >> dml:infoType ["status"]
   }?,
   element-interface-filter?
   >> dml:key ["concat(network, '/', prefix-length)"]
   >> dml:manual-validation-rule [
        "Verify that none of the subnets overlap with other subnets." ]
}

element-network = element network {
   ipv4-address-content
}
element-prefix-length = element prefix-length {
   xsd:short { minInclusive = "0" maxInclusive = "32" }
}

element-range = element range {
   element low  { ipv4-address-content }?,
   element high { ipv4-address-content }?
   >> dml:existence []
   >> dml:manual-validation-rule [
       "Verify the range is within the subnet." ]
}

element-dhcp-options = element dhcp-options {
   element-router-list-option? &
   element-domain-list-option? &
   element-custom-option*
}

element-lease = element lease {
   attribute ip-address { ipv4-address-content },
   element starts  { xsd:dateTime },
   element ends    { xsd:dateTime },
   element mac-address { mac-address-content }
   >> dml:key ["@ip-address"]
}

element-router-list-option = element router-list {
   element router { ipv4-address-content }+
     >> dml:order ["user-order"]
}
element-domain-list-option = element domain-list {
   element domain { token }+
}
element-custom-option = element custom {
   attribute option { xsd:unsignedByte },
   (
       element ip-address { ipv4-address-content }
     | element string { string }
   )
   >> dml:key ["@option"]
}

element-interface-filter = element interface-filter {
  element-interface+
}

element-interface = element interface {
    token >> dml:keyref ["//int:interface"]
}

# dhcp-tz.rnc
namespace rng = "http://relaxng.org/ns/structure/1.0"
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
namespace tz  = "http://example.org/ns/dhcp/timezone"
element-dhcp-option &= element tz:timezone { token }?

# dhcp-wins.rnc
namespace rng = "http://relaxng.org/ns/structure/1.0"
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
namespace wins = "http://example.org/ns/dhcp/wins-option"
element-dhcp-option &= element wins:wins-server { token }*

#network-types.rnc
namespace rng = "http://relaxng.org/ns/structure/1.0"
namespace xsd  = "http://www/w3/org/2001/XMLSchema-datatypes"
namespace xml  = "http://www.w3.org/XML/1998/namespace"
namespace sch  = "http://www.ascc.net/xml/schematron"
namespace dc   = "http://purl.org/dc/terms"
namespace dml  = "http://example.org/ns/dml"
namespace compat ="http://relaxng.org/ns/compatibility/annotations/1.0"

ipv4-address-content = xsd:token { pattern =
  "((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}" ~
  "(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])"
  }
mac-address-content  = xsd:token { pattern =
  "(([0-9a-fA-F]{2}):?){5}[0-9a-fA-F]{2}" }
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="example.org.ns.dhcp:1.0"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:ndl="urn:ietf:params:xml:ns:netmod:base"
       targetNamespace="example.org.ns.dhcp:1.0"
       elementFormDefault="qualified"
       attributeFormDefault="unqualified">

    <xs:import namespace="urn:ietf:params:xml:ns:netmod:base"
    schemaLocation="ndl-base.xsd"/>

    <!-- _________________managedResourceDef_______________________ -->

    <xs:complexType name="dhcp">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>managedResource</ndl:infoType>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="subnets">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="subnet" minOccurs="0"
                           maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="shared-networks">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="shared-network" minOccurs="0"
                           maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="default-lease-time" type="xs:int"/>
            <xs:element name="max-lease-time" type="xs:int"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="dhcp" type="dhcp"/>
    <xs:complexType name="subnet">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>managedResource</ndl:infoType>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="network" type="ndl:ipAddress"/>
            <xs:element name="prefix-length" type="xs:int"/>
            <xs:element name="leases" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="lease" minOccurs="0"
                           maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element ref="range" minOccurs="0"/>
            <xs:element ref="dhcp-options" minOccurs="0"/>
            <xs:element name="max-lease-time" type="xs:int"
                 minOccurs="0"/>
            <xs:element ref="interface-filter" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="subnet" type="subnet">
        <xs:key name="subnet_key_">
            <xs:selector xpath=".//subnet"/>
            <xs:field xpath="network"/>
            <xs:field xpath="prefix-length"/>
        </xs:key>
    </xs:element>
    <xs:complexType name="lease">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>managedResource</ndl:infoType>
                <ndl:maxAccess>
                    <ndl:read/>
                </ndl:maxAccess>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="ip-address" type="xs:string"/>
            <xs:element name="starts" type="xs:dateTime"/>
            <xs:element name="ends" type="xs:dateTime"/>
            <xs:element name="mac-address" type="ndl:nsapAddress"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="lease" type="lease">
        <xs:key name="lease_key_">
            <xs:selector xpath=".//lease"/>
            <xs:field xpath="ip-address"/>
        </xs:key>
    </xs:element>
    <xs:complexType name="shared-network">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>managedResource</ndl:infoType>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="name" type="xs:string"/>
            <xs:element name="subnets">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="subnet" minOccurs="0"
                           maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="shared-network" type="shared-network">
        <xs:key name="shared-network_key_">
            <xs:selector xpath=".//name"/>
            <xs:field xpath="shared-network"/>
        </xs:key>
    </xs:element>

    <!-- ______________________configDataDef_____________________ -->

    <xs:complexType name="range">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>configData</ndl:infoType>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="dynamic-bootp" type="xs:boolean"
               minOccurs="0"/>
            <xs:element name="low" type="ndl:ipAddress" minOccurs="0"/>
            <xs:element name="high" type="ndl:ipAddress" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="range" type="range"/>
    <xs:complexType name="dhcp-options">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>configData</ndl:infoType>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="router-list" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="router"
                            type="ndl:ipAddress" minOccurs="0"
                            maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="domain-list" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="domain" type="xs:string"
                             minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="custom-list" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="custom"
                            type="CustomOptionType"
                            minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="dhcp-options" type="dhcp-options"/>
    <xs:complexType name="interface-filter">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>configData</ndl:infoType>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="interface-list" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="interface" type="xs:string"
                           maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="interface-filter" type="interface-filter"/>

    <!-- _________________________typeDef_________________________ -->

    <xs:complexType name="CustomOptionType">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>complexType</ndl:infoType>
            </xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="option" type="OptionEnumType"/>
            <xs:element name="custom-value"
                type="IpAddressOrStringType"/>
        </xs:sequence>
    </xs:complexType>
    <xs:simpleType name="OptionEnumType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="150"/>
            <xs:enumeration value="171"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="IpAddressOrStringType">
        <xs:annotation>
            <xs:appinfo>
                <ndl:infoType>complexType</ndl:infoType>
            </xs:appinfo>
        </xs:annotation>
        <xs:choice>
            <xs:element name="ip-address" type="ndl:ipAddress"/>
            <xs:element name="string" type="xs:string"/>
        </xs:choice>
    </xs:complexType>
</xs:schema>
<kalua:module name="DHCP" xmlns:kalua="urn:ietf:params:xml:ns:kalua:1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:kalua:1:\Users\kalua\kalua.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <presentation>DHCP</presentation>
    <description>
       DHCP example, as in draft-presuhn-rcdml-03#appendix-C
    </description>
    <ns-uri>http://example.org/ns/dhcp</ns-uri>
    <ns-prefix>dhcp</ns-prefix>
    <release>1</release>
    <organization>Nokia Siemens Networks</organization>
    <import>
        <ns-uri>urn:ietf:params:xml:ns:netmod:base</ns-uri>
        <ns-prefix>ndl</ns-prefix>
    </import>
    <import>
        <ns-uri>http://example.com/ns/int</ns-uri>
        <ns-prefix>int</ns-prefix>
        <description>interfaces</description>
    </import>
    <class name="dhcp">
        <attribute name="default_lease_time">
            <presentation>default-lease-time</presentation>
            <type>kalua:int</type>
        </attribute>
        <attribute name="max_lease_time">
            <presentation>max-lease-time</presentation>
            <type>kalua:int</type>
        </attribute>
    </class>
    <relationship name="subnets">
        <kind>
            <containment/>
        </kind>
        <source>
            <class>dhcp</class>
            <role>parent</role>
        </source>
        <target>
            <class>subnet</class>
            <role>children</role>
        </target>
    </relationship>
    <class name="subnet">
        <attribute name="network">
            <type>ndl:ipAddress</type>
        </attribute>
        <attribute name="prefix_length">
            <presentation>prefix-length</presentation>
            <type>kalua:int</type>
        </attribute>
        <attribute name="range">
            <optional/>
            <type>rangeType</type>
        </attribute>
        <attribute name="max_lease_time">
            <presentation>max-lease-time</presentation>
            <type>kalua:int</type>
        </attribute>
        <attribute name="leases">
            <read-only/>
            <sequence elementName="lease">
                <structure>
                    <attribute name="ip_address">
                        <presentation>ip-address</presentation>
                        <type>ndl:ipAddress</type>
                    </attribute>
                    <attribute name="starts">
                        <type>kalua:dateTime</type>
                    </attribute>
                    <attribute name="ends">
                        <type>kalua:dateTime</type>
                    </attribute>
                    <attribute name="mac_address">
                        <presentation>mac-address</presentation>
                        <type>ndl:nsapAddress</type>
                    </attribute>
                    <key scope="local">
                        <member>ip_address</member>
                    </key>
                </structure>
            </sequence>
        </attribute>
        <attribute name="interface_filter">
            <sequence elementName="interface">
                <type>kalua:string</type>
            </sequence>
        </attribute>
        <key scope="global">
            <member>network</member>
            <member>prefix_length</member>
        </key>
    </class>
    <typedef name="rangeType">
        <structure>
            <attribute name="dynamic_bootp">
                <presentation>dynamic-bootp</presentation>
                <type>kalua:boolean</type>
                <defaultValueLiteral>true</defaultValueLiteral>
            </attribute>
            <attribute name="low">
                <mandatory/>
                <type>ndl:ipAddress</type>
            </attribute>
            <attribute name="high">
                <mandatory/>
                <type>ndl:ipAddress</type>
            </attribute>
        </structure>
    </typedef>
    <relationship name="dhcp_options_Rel">
        <kind>
            <containment/>
        </kind>
        <source>
            <class>dhcp</class>
            <role>dhcp</role>
        </source>
        <target>
            <class>dhcp_options</class>
            <role>dhcp_options</role>
        </target>
    </relationship>
    <class name="dhcp_options">
        <presentation>dhcp-options</presentation>
        <attribute name="router_list">
            <presentation>router-list</presentation>
            <sequence elementName="router">
                <type>ndl:ipAddress</type>
            </sequence>
        </attribute>
        <attribute name="domain_list">
            <presentation>domain-list</presentation>
            <sequence elementName="domain">
                <type>ndl:ipAddress</type>
            </sequence>
        </attribute>
        <attribute name="custom">
            <structure>
                <attribute name="option">
                    <type>kalua:int</type>
                </attribute>
                <attribute name="ip_address">
                    <presentation>ip-address</presentation>
                    <type>ndl:ipAddress</type>
                </attribute>
                <attribute name="string">
                    <type>kalua:string</type>
                </attribute>
            </structure>
        </attribute>
    </class>
    <relationship name="filtered_interfaces">
        <kind>
            <calculated>
                <condition>
                    $source/interface_filter/interface=$target/ifName
                </condition>
            </calculated>
        </kind>
        <source>
            <class>subnet</class>
            <role>filtering_subnet</role>
            <maxCardinality>unbounded</maxCardinality>
        </source>
        <target>
            <class>int:interface</class>
            <role>filtered_interface</role>
            <maxCardinality>unbounded</maxCardinality>
        </target>
    </relationship>
    <class name="shared_network">
        <attribute name="name">
            <type>kalua:string</type>
        </attribute>
        <key scope="global">
            <member>name</member>
        </key>
    </class>
    <relationship name="shared_network_subnets">
        <kind>
            <containment/>
        </kind>
        <source>
            <class>shared_network</class>
            <role>parent</role>
        </source>
        <target>
            <class>subnet</class>
            <role>children</role>
        </target>
    </relationship>
</kalua:module>

The Partial Locking model

The following model is for the partial locking model currently being worked on in the NETCONF working group.

YANG - 1003 characters Relax-NG - 1569 characters XSD - 1731 characters Kalua - 1949 characters
module netconf-partial-lock {
  namespace urn:ietf:params:xml:ns:netconf:partial-lock:1.0;
  prefix pl;

  organization "IETF NETCONF Working Group";

  contact
    "Balazs Lengyel
     Ericsson Hungary, Inc.
     balazs.lengyel@ericsson.com";

  description
    "This YANG module defines the <partial-lock> and
     <partial-unlock> operations.";

  revision 2008-01-07 {
    description "Inital version.";
  }

  grouping configName {
    description
       "A choice to list the datastore names for NETCONF.
        This could be moved to a netconf.yang module.";
    choice configNameType {
      leaf running   { type empty; }
      leaf candidate { type empty; }
      leaf startup   { type empty; }
    }
  }

  rpc partial-lock {
    input {
      uses configName;
      leaf-list select {
        type string;
        min-elements 1;
      }
    }
    output {
      leaf lockId { type uint32; }
    }
  }

  rpc partial-unlock {
    input {
      leaf lockId { type uint32; }
    }
  }
}
default namespace = "urn:ietf:params:xml:ns:netconf:partial-lock:1.0"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
namespace dc = "http://purl.org/dc/terms"
namespace dml = "http://example.org/ns/dml"

dml:dataModelVersion [ "1.0" ]
dc:title [
  "RELAX NG Schema for partial-lock and partial-unlock Operations"
]
dc:creator [ "Ladislav Lhotka" ]
dml:contact [ "mailto:lhotka@cesnet.cz" ]
dc:date [ "2008-03-03" ]
dc:subject [ "NETCONF, partial-lock, partial-unlock" ]
dc:publisher [ "IETF" ]
dc:identifier [ "urn:ietf:params:xml:ns:netconf:partial-lock:1.0" ]
dc:description [
  "This RELAX NG schema extends the base NETCONF grammar\x{a}" ~
  "by defining two new RPC operations: partial-lock and partial-unlock."
]

include "netconf-base.rnc"

## This pattern defines the element for partial-lock RPC operation.
## Positive response to this operation is the lock-id element.
partial-lock-element =
  element partial-lock {
    config-name-choice,
    element select { xsd:string }+
  }

## This pattern defines the element for partial-unlock
## RPC operation. The standard positive response (rpc-reply with ok)
## is sent if the operation succeeds.
partial-unlock-element = element partial-unlock { lock-id-element }

## This pattern extends the same pattern from the base NETCONF
## schema by adding two new RPC operations.
rpc-operation-choice |= partial-lock-element | partial-unlock-element

## This element is used as a parameter to partial-unlock
## and return value of partial-lock.
lock-id-element = element lock-id { xsd:unsignedInt }
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="urn:ietf:params:netconf:capability:partial-lock:1.0"
  xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
  targetNamespace="urn:ietf:params:netconf:capability:partial-lock:1.0"
  elementFormDefault="qualified" attributeFormDefault="unqualified">

  <xs:annotation>
    <xs:documentation>
      Schema defining the partial-lock and unlock operations.
    </xs:documentation>
  </xs:annotation>

  <xs:import namespace="urn:ietf:params:xml:ns:netconf:base:1.0"
    schemaLocation="/export/localhome/ethbll/netconf/xml/netconf.xsd"/>

  <xs:complexType name="partialLockType">
    <xs:complexContent>
      <xs:extension base="nc:rpcOperationType">
        <xs:sequence>
          <xs:element ref="nc:config-name"/>
          <xs:element name="select" type="xs:string"
                                       maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="partialUnLockType">
    <xs:complexContent>
      <xs:extension base="nc:rpcOperationType">
        <xs:sequence>
          <xs:element name="lock-id" type="xs:unsignedInt"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- <partial-lock> operation -->
  <xs:element name="partial-lock" type="partialLockType"
                     substitutionGroup="nc:rpcOperation"/>

  <!-- <partial-unlock> operation -->
  <xs:element name="partial-unlock" type="partialUnLockType"
                     substitutionGroup="nc:rpcOperation"/>

  <!-- reply to <partial-lock> -->
  <xs:element name="lock-id" type="xs:unsignedInt"/>

</xs:schema>
<kalua:module name="NCPL" xmlns:kalua="urn:ietf:params:xml:ns:kalua:1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:kalua:1:\Users\kalua\kalua.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <presentation>NETCONF partial lock</presentation>
    <description>NETCONF partial lock operations</description>
    <ns-uri>urn:ietf:params:xml:ns:netconf:partial-lock:1.0</ns-uri>
    <ns-prefix>ncpl</ns-prefix>
    <release>1</release>
    <organization>IETF</organization>
    <import>
        <ns-uri>urn:ietf:params:xml:ns:netconf:base:1.0</ns-uri>
        <ns-prefix>nc</ns-prefix>
    </import>
    <attribute-group name="lock_id_attribute">
        <attribute name="lock_id">
            <type>kalua:unsignedInt</type>
        </attribute>
    </attribute-group>
    <operation name="partial_lock">
        <description>
        This operation defines the element for partial-lock RPC
        operation. Positive response to this operation is the
        "lock-id" element.
        </description>
        <input>
            <attribute name="config_name">
                <type>nc:config_name</type>
            </attribute>
            <attribute name="select">
                <sequence>
                    <type>kalua:string</type>
                </sequence>
            </attribute>
        </input>
        <output>
            <use>
                <attribute-group>sadasd</attribute-group>
            </use>
        </output>
    </operation>
    <operation name="partial_unlock">
        <description>
        This operation defines the element for partial-unlock RPC
        operation. The standard positive response
        (rpc-reply with <nc:ok/>) is sent if the operation
        succeeds.
        </description>
        <input>
            <use>
                <attribute-group>sadasd</attribute-group>
            </use>
        </input>
    </operation>
</kalua:module>
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
YANG
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback