Using DSDL plus annotations for Netconf data modeling - PowerPoint PPT Presentation

About This Presentation
Title:

Using DSDL plus annotations for Netconf data modeling

Description:

keys to uniquely identify elements in a list. define relational integrity constraints ... namespace tz = 'http://example.org/ns/dhcp/timezone' ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 19
Provided by: Rohan1
Learn more at: https://www.ietf.org
Category:

less

Transcript and Presenter's Notes

Title: Using DSDL plus annotations for Netconf data modeling


1
Using DSDL plus annotations for Netconf () data
modeling
  • Rohan Mahy
  • rohan_at_ekabal.com
  • draft-mahy-canmod-dsdl-01

2
What is DSDL?
  • DSDL Document Schema Data Languages
    http//dsdl.org
  • An ISO family of standards
  • DSDL uses a modular approach to schema languages
  • Part 2 Relax NG - traditional schema language
    structure
  • Part 3 Schematron - rule based validation
  • Part 4 NVRL - validate parts of instance doc
    with different schemas/languages
  • Part 5 DataType Library Language
  • etc
  • Annotations are encouraged as part of modularity
  • My usage of Data Model
  • A model for describing the semantics and syntax
    of (configuration and operational) data. Does
    not include verbs.

3
Why Relax NG for syntax?
  • Easy to read and learn (Compact or XML)
  • Used by W3C (XHTML, SVG, XML Sig, RDF)
  • Better XML support than XSD
  • robust native support for XML namespaces
  • unifies elements and attributes
  • unordered content supported
  • describes which pattern is root element
  • Convertible to XSD
  • Patterns can be scoped to prevent conflicts from
    one module

4
Schematron - rule-based validation
  • Rule-based validation based on XPath expressions.
  • Supports reusable abstract patterns
  • Validation can be split in phases based on
    context
  • Implementer can use a Schematron validator or
    write their own native code to perform an
    equivalent validation check.

ltpatterngt ltrule context"//dhcpdhcp"gt
ltassert test"dhcpdefault-lease-time
lt dhcpmax-lease-time"gt Default
lease time cannot be larger than maximum lease
time lt/assertgt lt/rulegt lt/patterngt
5
Semantic Annotations
  • Important annotations
  • keys to uniquely identify elements in a list
  • define relational integrity constraints
  • insure data is relevant to operation containing
    it
  • These annotations can be implemented in native
    code on device or converted to additional
    Schematron rules by XSLT

6
Extensibility
  • Relax NG has a nice pattern-based extensibility
    mechanism
  • redefine patterns completely
  • combine by choice
  • combine by interleave
  • Can include external grammars and keep scopes
    separate (ex both dhcp.rnc and interfaces.rnc
    have an element-interface pattern)
  • config-root.rnc
  • default namespace "http//example.org/ns/root"
  • start element-config
  • element-config element config
  • external "interfaces.rnc" ?
  • external "dhcpextensions.rnc" ?
  • dhcpextensions.rnc
  • include "dhcp.rnc" base module
  • include "dhcp-tz.rnc" timezone extension
  • include "dhcp-wins.rnc" WINS server ext
  • dhcp-tz.rnc
  • namespace tz "http//example.org/ns/dhcp/timezo
    ne"
  • element-dhcp-option element tztimezone
    token
  • ?

7
Met nearly all requirements in RCDML draft
  • Met ALL Netconf-specific requirements (Section
    3.1)
  • Some highlighted unique features
  • Compound keys / Deep keys
  • ltsubnetgt
  • ltprefixgt
  • ltnetworkgt192.168.24.0lt/networkgt
  • ltprefix-lengthgt24lt/prefix-lengthgt
  • lt/prefixgt
  • ltrangegt
  • ltlowgt192.168.24.20lt/lowgt
  • lthighgt192.168.24.250lt/highgt
  • lt/rangegt
  • lt/subnetgt
  • Implementation Defaults
  • Most defaults are valid per version of the
    schema.
  • Formal validation w/ Schematron
  • Can implement these rules via custom code from
    assert text, or automatically using a Schematron
    validator (free libraries in C, Java, C and
    Python)

8
Whats nice about this approach
  • Reuse of appropriate schema languages and tools
    is a good thing.
  • Modular architecture makes incremental
    implementation/deployment and additional reuse
    easier (add other parts of DSDL, use subset of
    Netconf solution for another IETF protocol).
  • Being able to add data model information for
    existing IETF schemas (LDAP-enabled directories,
    SIP phone config files, early Netconf users) is a
    good thing.
  • Making Schematron available for formal
    machine-readable validation to clients that want
    it is a good thing.

9
Schema Plus vs. Model Plus approach
  • Pure Semantics
  • UML / XMI
  • OWL (without a specific serialization)
  • Semantics some syntax (top down)
  • Yang
  • Kalua
  • Schema some semantics (bottom up)
  • DSDL annotations
  • XSD annotations

10
Semantics vs. Syntax dilemma
  • Pure semantic approaches can represent things we
    cannot easily represent in Netconf or even in XML
    syntax
  • Many to many relationships (graph vs tree)
  • Top down approaches can constrain legitimately
    good syntax and blur semantics
  • element vs. attribute representation of terminal
    nodes
  • not distinguishing semantically ordered content
    (sequence) from unordered content (bags)
  • Bottom up approaches are not easily convertible
    to radically different syntax (ex CLI, MIBs).
    Can't represent inheritance/classes natively, but
    can generate equivalent instance documents.

11
Upgrading schema to data model
  • There are lots of XML-based schema in the wild
    (XSD and Relax NG).
  • It seems very beneficial to be able to take an
    existing schema and turn it into a data model
    while maintaining backward syntax compatibility
  • Folks who defined XSD for use with Netconf.
  • Other IETF WGs that already defined syntax of
    their schema but want data modeling.
  • Other schemas defined elsewhere that we want to
    import for Netconf.

12
Start with basic Relax NG
start element-dhcp element-dhcp element dhcp
compatdocumentation "DHCP top level
element" element subnet element
network ipv4-address-content , element
prefix-length xsdshort minInclusive
"0" maxInclusive "32"
element-range?, element leases
element-lease ?, element-range
element range element low
ipv4-address-content , element high
ipv4-address-content gtgt compatdocumentation
"range of dynamic addresses" element-lease
element lease attribute ip-address
ipv4-address-content , element starts
xsddateTime , element ends xsddateTime
, element mac-address mac-address-content

Syntax describes hierarchy, cardinality, types,
range and pattern restrictions Relax NG Compact
and XML forms are 2-way convertible Add
annotationsinitial and following types
13
infoType used to validate that data is sent in an
appropriate operation
element-leases element leases element lease
attribute ip-address ipv4-address-content
, element starts xsddateTime ,
element ends xsddateTime , element
mac-address mac-address-content gtgt
dmlinfoType "status"
can be in a get
can be in RPCrevoke-lease request
revokeLeaseType element revoke-lease
element address ipv4-address-content gtgt
dmlinfoType op"rpc/revoke-lease"
"action" revokeLeaseResponseType element
result ( "ok" "no-such-lease" ) gtgt
dmlinfoType op"rpc-responserevoke-lease"
"status"
can be in RPCreply for a revoke-lease
14
Keys and Keyrefs
element-subnet element subnet element
network ipv4-address-content , element
prefix-length xsdshort minInclusive
"0" maxInclusive "32" , element
interface-filter element interface
xsdtoken gtgt dmlkeyref "//intinterface"
element-interfaces element
intinterfaces element intinterface
element intifIndex xsdtoken , element
intifType xsdtoken gtgt dmlkey
"intifIndex"
ltconfigconfig xmlns"http//example.org/ns/dhcp"
xmlnsconfig"http//example.org/ns/config"
xmlnsdhcp"http//example.org/ns/dhcp"
xmlnsint"http//example.org/ns/int"gt
ltdhcpgt ltsubnetgt
ltnetworkgt10.1.1.0lt/networkgt
ltprefix-lengthgt24lt/prefix-lengthgt
ltinterface-filtergt
ltinterfacegtlo0lt/interfacegt
ltinterfacegten1lt/interfacegt
lt/interface-filtergt lt/subnetgt
lt/dhcpgt ltintinterfacesgt
ltintinterfacegtltintifIndexgtlo0lt/intifIndexgt
lt/intinterfacegt ltintinterfacegtltinti
fIndexgten2lt/intifIndexgt
lt/intinterfacegt lt/intinterfacesgt lt/configco
nfiggt
15
XSLT converts this to Schematron
ltpattern abstract"true" id"key"gt ltrule
context"context"gt ltassert
test"count(contextkeycurrent()/key)1"gt
The key "key" needs to be unique within the
list at context lt/assertgt
lt/rulegt lt/patterngt ltpattern is-a"key"
id"interface"gt ltparam name"context"
value"//intinterfaces/intinterface"/gt ltparam
name"key" value"intkey"/gt lt/patterngt ltpattern
abstract"true" id"keyref"gt ltrule
context"keyref-context"gt ltassert
test"key-contextkeycurrent()"gt The
contents of "keyref-context" must be a ltname/gt
with the key "key" in this context
key-context. lt/assertgt lt/rulegt lt/patterngt
ltpattern is-a"keyref"gt ltparam
name"keyref-context" value"//dhcpinter
face-filter/dhcpinterface"/gt ltparam
name"key-context" value"//intinterfaces/intint
erface"/gt ltparam name"key" value"intifIndex"/
gt lt/patterngt
16
start element-dhcp element-dhcp element dhcp
global-timer-elements, element-subnet,
element-shared-network gtgt dctitle
"Example schema for DHCP server" gtgt
dmlversion "1.0" gtgt dctype "Dataset"
gtgt dccreator "Rohan Mahy" gtgt
dmlorganization "as an individual" gtgt
dmlcontact "mailtorohan_at_ekabal.com" gtgt
dccreated "2008-02-13" global-timer-elemen
ts ( element default-lease-time
xsdunsignedInt gtgt compatdefaultValue
"3600" gtgt dmlunits "s" ?, element
max-lease-time xsdunsignedInt gtgt dmlunits
"s" ? ) element-shared-network element
shared-network attribute name token ,
element-subnet
17
element-subnet element subnet
element-network, element-prefix-length,
element-range?, element-dhcp-options?,
element max-lease-time xsdunsignedInt
gtgt dmlunits "s" gtgt dmlstatus
"deprecated" ?, element leases
element-lease gtgt dmlinfoType "status"
?, element-interface-filter? gtgt dmlkey
"concat(network, '/', prefix-length)" gtgt
dmlmanual-validation-rule "Verify that
none of the subnets overlap with other subnets."
element-range element range element
low ipv4-address-content ?, element high
ipv4-address-content ? gtgt dmlexistence
gtgt dmlmanual-validation-rule "Verify
the range is within the subnet."
18
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
xsddateTime , element ends xsddateTime
, element mac-address mac-address-content
gtgt dmlkey "_at_ip-address" element-custom-
option element custom attribute option
xsdunsignedByte , ( element
ip-address ipv4-address-content
element string string ) gtgt dmlkey
"_at_option" element-interface-filter element
interface-filter element-interface
element-interface element interface
token gtgt dmlkeyref "//intinterface"
Write a Comment
User Comments (0)
About PowerShow.com