120 likes | 235 Views
Complex Types and Typed Instance Identifiers. IETF #76 NETMOD WG bernd.linowski.ext@nsn.com mehmet.ersue@nsn.com. Changes since IETF 75. Complex types as “YANG extensions” Modified complex type syntax: Renamed “element(-list)” to “instance-(list)” New extension keyword “instance-type”
E N D
Complex Types and Typed Instance Identifiers IETF #76 NETMOD WG bernd.linowski.ext@nsn.com mehmet.ersue@nsn.com
Changes since IETF 75 • Complex types as “YANG extensions” • Modified complex type syntax: • Renamed “element(-list)” to “instance-(list)” • New extension keyword “instance-type” • Update rules for complex types added • Complex type feature added • IANA considerations addressed -> Semantics of complex types unchanged!
Complex Types and Typed Instance Identifiers Specified in form of a YANG module: module complex-types { // … prefix "ct"; // … extension complex-type { description "Defines a complex-type."; reference "chapter 2.2., complex-type extension statement"; argument type-identifier { yin-element true; } } extension extends { description "Defines the base type of a complex-type."; reference "chapter 2.5., extends extension statement"; argument base-type-identifier { yin-element true; } } // …. feature complex-types { description "This feature indicates that the agent supports complex types and instance identifiers."; } } Extension definitions Feature indicating complex type support
Further steps • pyang plug-ins • complex type validation (under construction) • mapping to XSD and RelaxNG (planned) • Anything to add to the draft? • We welcome any comments • Is anybody interested to co-author? • How should we proceed? • Proposed standard or Experimental?
Thank You! Question?
Support for High-Level abstractions TMF SID: • Complex types • Blueprint for instances ct:complex-type Equipment { ct:extends PyhsicalContainer; ct:abstract true; leaf installStatus { … } ct:instance-list equipment { type Equipment; } } ct:complex-type Card { ct:extends Equipment; … } • Complex type instances • single • list Complex types Extensions
Recursive Structures in Model and Payload Complex type nesting ct:complex-type EquipmentHolder { ct:extends ManagedHardware; ct:abstract true; ct:instance-list equipment { type Equipment; } ct:instance-list holder { type EquipmentHolder; } } Recursive containment with unknown depth
Recursive Structures in Model and Payload <holder> <objectId>Rack-A2</objectId> … <holder> <objectId>Subrack-1</objectId> … <equipment> <objectId>Card-1</objectId> … </equipment> <holder> <objectId>Backplane-A</objectId> … <equipment> <objectId>Card-1</objectId> … </equipment> </holder> </holder> </holder> <holder> // … more holders </holder> NETCONF payload reflects instance nesting Simple filter to select sub-tree under a particular tree node <filter type="subtree"> <top xmlns="http://example.com/hw"> <holder> <objectId>Rack-A2</objectId> </holder> </top> </filter>
Base Type Substitution ct:complex-type PhysicalPort { ct:abstract true; key portNumber; leaf portNumber { type int32; mandatory true; } } ct:complex-type Card { ct:instance-list port { type PhysicalPort; } } … ct:complex-type PluginModule { ct:instance-list port { type PhysicalPort; } } Derived complex-type: ct:complex-type ExtPhysicalPort { ct:extends PhysicalPort; } • Substitution of base type instance with derived type instances • wherever the base type is used • no need to know all places it is used
Rich Type Definitions • Definition of abstract types • enforce common attributes • must be extended to be instantiated ct:complex-type PhysicalPort { ct:abstract true; key portNumber; leaf portNumber { type int32; mandatory true; } } ct:complex-type Card { ct:instance-list port { type PhysicalPort; } } ct:complex-type PluginModule { ct:instance-list port { type PhysicalPort; } } • Definition of types with a key • no need to add key definitions at every place of use
Type Information In Payload <holder> <objectId>R31s2</objectId> <ct:type>hw:Slot</ct:type> <slotNumber>1</slotNumber> <ymi:type>hw:EquipmentHolder</ymi:type> <equipment> <objectId>ATM-45252</objectId> <ct:type>hw:STMCard</ct:type> <level>16</level> <ct:type>hw:Card</ct:type> <usedSlots>1</usedSlots> <installed>true</installed> <version>A2</version> <redundancy>1</redundancy> <serialNumber>A-778911-b</serialNumber> <commonName>ATM-ADM 2</commonName> </equipment> <serialNumber>T-K4733890x45</serialNumber> <commonName>CU-Slot</commonName> </holder> • Use of predefined set of properties controlled by a type • Type information in the payload • Enables handling of unknown derived types • Does not require explicit type codes • Filtering types including derived types
Instance Identifiers Restricted by Type ct:complex-type PhysicalPort { ct:extends ManagedHardware; leaf portNumber { type int32; mandatory true; } } ct:complex-type PhysicalLink { ct:extends ManagedHardware; leaf-list connectedPort { type instance-identifier { ct:instance-type PhysicalPort; } min-elements 2; } } Constrains what type of entity may be identified • Allows to refer to instances of • referred type • derived types added later