Appendix A. YANG Modules for Physical Network Resource Model and Hardware Entities Model
YANG module for the 'Physical Network Resource Model': <CODE BEGINS> module udmcore { namespace "http://example.com/udmcore"; prefix "udm"; import ietf-yang-types {prefix "yang";} import ietf-complex-types {prefix "ct";} ct:complex-type BasicObject { ct:abstract true; key "distinguishedName"; leaf globalId {type int64;} leaf distinguishedName {type string; mandatory true;} } ct:complex-type ManagedObject { ct:extends BasicObject; ct:abstract true; leaf instance {type string;} leaf objectState {type int32;} leaf release {type string;} } ct:complex-type Resource { ct:extends ManagedObject; ct:abstract true; leaf usageState {type int16;} leaf managementMethodSupported {type string;} leaf managementMethodCurrent {type string;} leaf managementInfo {type string;} leaf managementDomain {type string;} leaf version {type string;} leaf entityIdentification {type string;} leaf description {type string;} leaf rootEntityType {type string;} }
ct:complex-type LogicalResource { ct:extends Resource; ct:abstract true; leaf lrStatus {type int32;} leaf serviceState {type int32;} leaf isOperational {type boolean;} } ct:complex-type PhysicalResource { ct:extends Resource; ct:abstract true; leaf manufactureDate {type string;} leaf otherIdentifier {type string;} leaf powerState {type int32;} leaf serialNumber {type string;} leaf versionNumber {type string;} } ct:complex-type Hardware { ct:extends PhysicalResource; ct:abstract true; leaf width {type string;} leaf height {type string;} leaf depth {type string;} leaf measurementUnits {type int32;} leaf weight {type string;} leaf weightUnits {type int32;} leaf-list physicalLink { type instance-identifier { ct:instance-type PhysicalLink; } } ct:instance-list containedHardware { ct:instance-type Hardware; } ct:instance-list physicalConnector { ct:instance-type PhysicalConnector; } } ct:complex-type PhysicalLink { ct:extends PhysicalResource; leaf isWireless {type boolean;} leaf currentLength {type string;} leaf maximumLength {type string;}
leaf mediaType {type int32;} leaf-list hardware { type instance-identifier { ct:instance-type Hardware; } } } ct:complex-type ManagedHardware { ct:extends Hardware; leaf additionalinfo {type string;} leaf physicalAlarmReportingEnabled {type boolean;} leaf pyhsicalAlarmStatus {type int32;} leaf coolingRequirements {type string;} leaf hardwarePurpose {type string;} leaf isPhysicalContainer {type boolean;} } ct:complex-type AuxiliaryComponent { ct:extends ManagedHardware; ct:abstract true; } ct:complex-type PhysicalPort { ct:extends ManagedHardware; leaf portNumber {type int32;} leaf duplexMode {type int32;} leaf ifType {type int32;} leaf vendorPortName {type string;} } ct:complex-type PhysicalConnector { ct:extends Hardware; leaf location {type string;} leaf cableType {type int32;} leaf gender {type int32;} leaf inUse {type boolean;} leaf pinDescription {type string;} leaf typeOfConnector {type int32;} leaf-list sourcePhysicalConnector { type instance-identifier { ct:instance-type PhysicalConnector; } }
leaf-list targetPhysicalConnector { type instance-identifier { ct:instance-type PhysicalConnector; } } } ct:complex-type Equipment { ct:extends ManagedHardware; leaf installStatus {type int32;} leaf expectedEquipmentType {type string;} leaf installedEquipmentType {type string;} leaf installedVersion {type string;} leaf redundancy {type int32;} leaf vendorName {type string;} leaf dateOfLastService {type yang:date-and-time;} leaf interchangeability {type string;} leaf identificationCode {type string;} ct:instance-list equipment { ct:instance-type Equipment; } } ct:complex-type EquipmentHolder { ct:extends ManagedHardware; leaf vendorName {type string;} leaf locationName {type string;} leaf dateOfLastService {type yang:date-and-time;} leaf partNumber {type string;} leaf availabilityStatus {type int16;} leaf nameFromPlanningSystem {type string;} leaf modelNumber {type string;} leaf acceptableEquipmentList {type string;} leaf isSolitaryHolder {type boolean;} leaf holderStatus {type int16;} leaf interchangeability {type string;} leaf equipmentHolderSpecificType {type string; } leaf position {type string;} leaf atomicCompositeType {type int16;} leaf uniquePhysical {type boolean;} leaf physicalDescription {type string;} leaf serviceApproach {type string;} leaf mountingOptions {type int32;} leaf cableManagementStrategy {type string;} leaf isSecureHolder {type boolean;} ct:instance-list equipment {
ct:instance-type Equipment; } ct:instance-list equipmentHolder { ct:instance-type EquipmentHolder; } } // ... other resource complex types ... } <CODE ENDS> YANG module for the 'Hardware Entities Model': <CODE BEGINS> module hardware-entities { namespace "http://example.com/:hardware-entities"; prefix "hwe"; import ietf-yang-types {prefix "yang";} import ietf-complex-types {prefix "ct";} import udmcore {prefix "uc";} grouping PhysicalEntityProperties { leaf hardwareRev {type string; } leaf firmwareRev {type string; } leaf softwareRev {type string; } leaf serialNum {type string; } leaf mfgName {type string; } leaf modelName {type string; } leaf alias {type string; } leaf ssetID{type string; } leaf isFRU {type boolean; } leaf mfgDate {type yang:date-and-time; } leaf-list uris {type string; } } // Physical entities representing equipment ct:complex-type Module { ct:extends uc:Equipment; description "Complex type representing module entries
(entPhysicalClass = module(9)) in entPhysicalTable"; uses PhysicalEntityProperties; } ct:complex-type Backplane { ct:extends uc:Equipment; description "Complex type representing backplane entries (entPhysicalClass = backplane(4)) in entPhysicalTable"; uses PhysicalEntityProperties; } // Physical entities representing auxiliary hardware components ct:complex-type PowerSupply { ct:extends uc:AuxiliaryComponent; description "Complex type representing power supply entries (entPhysicalClass = powerSupply(6)) in entPhysicalTable"; uses PhysicalEntityProperties; } ct:complex-type Fan { ct:extends uc:AuxiliaryComponent; description "Complex type representing fan entries (entPhysicalClass = fan(7)) in entPhysicalTable"; uses PhysicalEntityProperties; } ct:complex-type Sensor { ct:extends uc:AuxiliaryComponent; description "Complex type representing sensor entries (entPhysicalClass = sensor(8)) in entPhysicalTable"; uses PhysicalEntityProperties; } // Physical entities representing equipment holders ct:complex-type Chassis { ct:extends uc:EquipmentHolder; description "Complex type representing chassis entries (entPhysicalClass = chassis(3)) in entPhysicalTable"; uses PhysicalEntityProperties; } ct:complex-type Container { ct:extends uc:EquipmentHolder; description "Complex type representing container entries
(entPhysicalClass = container(5)) in entPhysicalTable"; uses PhysicalEntityProperties; } ct:complex-type Stack { ct:extends uc:EquipmentHolder; description "Complex type representing stack entries (entPhysicalClass = stack(11)) in entPhysicalTable"; uses PhysicalEntityProperties; } // Other kinds of physical entities ct:complex-type Port { ct:extends uc:PhysicalPort; description "Complex type representing port entries (entPhysicalClass = port(10)) in entPhysicalTable"; uses PhysicalEntityProperties; } ct:complex-type CPU { ct:extends uc:Hardware; description "Complex type representing cpu entries (entPhysicalClass = cpu(12)) in entPhysicalTable"; uses PhysicalEntityProperties; } } <CODE ENDS>Appendix B. Example YANG Module for the IPFIX/PSAMP Model
B.1. Modeling Improvements for the IPFIX/PSAMP Model with Complex Types and Typed Instance Identifiers
The module below is a variation of the IPFIX/PSAMP configuration model, which uses complex types and typed instance identifiers to model the concept outlined in [IPFIXCONF]. When looking at the YANG module with complex types and typed instance identifiers, various technical improvements on the modeling level become apparent. o There is almost a one-to-one mapping between the domain concepts introduced in IPFIX and the complex types in the YANG module.
o All associations between the concepts (besides containment) are represented with typed identifiers. That avoids having to refer to a particular location in the tree. Referring to a particular in the tree is not mandated by the original model. o It is superfluous to represent concept refinement (class inheritance in the original model) with containment in the form of quite big choice-statements with complex branches. Instead, concept refinement is realized by complex types extending a base complex type. o It is unnecessary to introduce metadata identities and leafs (e.g., "identity cacheMode" and "leaf cacheMode" in "grouping cacheParameters") that just serve the purpose of indicating which concrete subtype of a generic type (modeled as grouping, which contains the union of all features of all subtypes) is actually represented in the MIB. o Ruling out illegal use of subtype-specific properties (e.g., "leaf maxFlows") by using "when" statements that refer to a subtype discriminator is not necessary (e.g., when "../cacheMode != 'immediate'"). o Defining properties like the configuration status wherever a so called "parameter grouping" is used is not necessary. Instead, those definitions can be put inside the complex type definition itself. o Separating the declaration of the key from the related data nodes definitions in a grouping (see use of "grouping selectorParameters") can be avoided. o Complex types may be declared as optional features. If the type is indicated with an identity (e.g., "identity immediate"), this is not possible, since "if-feature" is not allowed as a substatement of "identity".B.2. IPFIX/PSAMP Model with Complex Types and Typed Instance Identifiers
<CODE BEGINS> module ct-ipfix-psamp-example { namespace "http://example.com/ns/ct-ipfix-psamp-example"; prefix ipfix; import ietf-yang-types { prefix yang; } import ietf-inet-types { prefix inet; } import ietf-complex-types {prefix "ct"; }
description "Example IPFIX/PSAMP Configuration Data Model with complex types and typed instance identifiers"; revision 2011-03-15 { description "The YANG Module ('YANG Module of the IPFIX/PSAMP Configuration Data Model') in [IPFIXCONF] modeled with complex types and typed instance identifiers. Disclaimer: This example model illustrates the use of the language extensions defined in this document and does not claim to be an exact reproduction of the original YANG model referred above. The original description texts have been shortened to increase the readability of the model example."; } /***************************************************************** * Features *****************************************************************/ feature exporter { description "If supported, the Monitoring Device can be used as an Exporter. Exporting Processes can be configured."; } feature collector { description "If supported, the Monitoring Device can be used as a Collector. Collecting Processes can be configured."; } feature meter { description "If supported, Observation Points, Selection Processes, and Caches can be configured."; } feature psampSampCountBased { description "If supported, the Monitoring Device supports count-based Sampling..."; } feature psampSampTimeBased { description "If supported, the Monitoring Device supports time-based Sampling..."; } feature psampSampRandOutOfN { description "If supported, the Monitoring Device supports random n-out-of-N Sampling..."; }
feature psampSampUniProb { description "If supported, the Monitoring Device supports uniform probabilistic Sampling..."; } feature psampFilterMatch { description "If supported, the Monitoring Device supports property match Filtering..."; } feature psampFilterHash { description "If supported, the Monitoring Device supports hash-based Filtering..."; } feature cacheModeImmediate { description "If supported, the Monitoring Device supports Cache Mode 'immediate'."; } feature cacheModeTimeout { description "If supported, the Monitoring Device supports Cache Mode 'timeout'."; } feature cacheModeNatural { description "If supported, the Monitoring Device supports Cache Mode 'natural'."; } feature cacheModePermanent { description "If supported, the Monitoring Device supports Cache Mode 'permanent'."; } feature udpTransport { description "If supported, the Monitoring Device supports UDP as transport protocol."; } feature tcpTransport { description "If supported, the Monitoring Device supports TCP as transport protocol."; } feature fileReader { description "If supported, the Monitoring Device supports the configuration of Collecting Processes as File Readers.";
} feature fileWriter { description "If supported, the Monitoring Device supports the configuration of Exporting Processes as File Writers."; } /***************************************************************** * Identities *****************************************************************/ /*** Hash function identities ***/ identity hashFunction { description "Base identity for all hash functions..."; } identity BOB { base "hashFunction"; description "BOB hash function"; reference "RFC 5475, Section 6.2.4.1."; } identity IPSX { base "hashFunction"; description "IPSX hash function"; reference "RFC 5475, Section 6.2.4.1."; } identity CRC { base "hashFunction"; description "CRC hash function"; reference "RFC 5475, Section 6.2.4.1."; } /*** Export mode identities ***/ identity exportMode { description "Base identity for different usages of export destinations configured for an Exporting Process..."; } identity parallel { base "exportMode"; description "Parallel export of Data Records to all destinations configured for the Exporting Process."; } identity loadBalancing { base "exportMode"; description "Load-balancing between the different destinations..."; } identity fallback { base "exportMode";
description "Export to the primary destination..."; } /*** Options type identities ***/ identity optionsType { description "Base identity for report types exported with options..."; } identity meteringStatistics { base "optionsType"; description "Metering Process Statistics."; reference "RFC 5101, Section 4.1."; } identity meteringReliability { base "optionsType"; description "Metering Process Reliability Statistics."; reference "RFC 5101, Section 4.2."; } identity exportingReliability { base "optionsType"; description "Exporting Process Reliability Statistics."; reference "RFC 5101, Section 4.3."; } identity flowKeys { base "optionsType"; description "Flow Keys."; reference "RFC 5101, Section 4.4."; } identity selectionSequence { base "optionsType"; description "Selection Sequence and Selector Reports."; reference "RFC 5476, Sections 6.5.1 and 6.5.2."; } identity selectionStatistics { base "optionsType"; description "Selection Sequence Statistics Report."; reference "RFC 5476, Sections 6.5.3."; } identity accuracy { base "optionsType"; description "Accuracy Report."; reference "RFC 5476, Section 6.5.4."; } identity reducingRedundancy { base "optionsType"; description "Enables the utilization of Options Templates to reduce redundancy in the exported Data Records.";
reference "RFC 5473."; } identity extendedTypeInformation { base "optionsType"; description "Export of extended type information for enterprise-specific Information Elements used in the exported Templates."; reference "RFC 5610."; } /***************************************************************** * Type definitions *****************************************************************/ typedef nameType { type string { length "1..max"; pattern "\S(.*\S)?"; } description "Type for 'name' leafs..."; } typedef direction { type enumeration { enum ingress { description "This value is used for monitoring incoming packets."; } enum egress { description "This value is used for monitoring outgoing packets."; } enum both { description "This value is used for monitoring incoming and outgoing packets."; } } description "Direction of packets going through an interface or linecard."; } typedef transportSessionStatus { type enumeration { enum inactive { description "This value MUST be used for..."; } enum active { description "This value MUST be used for...";
} enum unknown { description "This value MUST be used if the status..."; } } description "Status of a Transport Session."; reference "RFC 5815, Section 8 (ipfixTransportSessionStatus)."; } /***************************************************************** * Complex types *****************************************************************/ ct:complex-type ObservationPoint { description "Observation Point"; key name; leaf name { type nameType; description "Key of an observation point."; } leaf observationPointId { type uint32; config false; description "Observation Point ID..."; reference "RFC 5102, Section 5.1.10."; } leaf observationDomainId { type uint32; mandatory true; description "The Observation Domain ID associates..."; reference "RFC 5101."; } choice OPLocation { mandatory true; description "Location of the Observation Point."; leaf ifIndex { type uint32; description "Index of an interface..."; reference "RFC 2863."; } leaf ifName { type string; description "Name of an interface..."; reference "RFC 2863."; } leaf entPhysicalIndex { type uint32; description "Index of a linecard...";
reference "RFC 4133."; } leaf entPhysicalName { type string; description "Name of a linecard..."; reference "RFC 4133."; } } leaf direction { type direction; default both; description "Direction of packets...."; } leaf-list selectionProcess { type instance-identifier { ct:instance-type SelectionProcess; } description "Selection Processes in this list process packets in parallel."; } } ct:complex-type Selector { ct:abstract true; description "Abstract selector"; key name; leaf name { type nameType; description "Key of a selector"; } leaf packetsObserved { type yang:counter64; config false; description "The number of packets observed ..."; reference "RFC 5815, Section 8 (ipfixSelectionProcessStatsPacketsObserved)."; } leaf packetsDropped { type yang:counter64; config false; description "The total number of packets discarded ..."; reference "RFC 5815, Section 8 (ipfixSelectionProcessStatsPacketsDropped)."; } leaf selectorDiscontinuityTime { type yang:date-and-time; config false; description "Timestamp of the most recent occasion at which one or more of the Selector counters suffered a discontinuity...";
reference "RFC 5815, Section 8 (ipfixSelectionProcessStatsDiscontinuityTime)."; } } ct:complex-type SelectAllSelector { ct:extends Selector; description "Method that selects all packets."; } ct:complex-type SampCountBasedSelector { if-feature psampSampCountBased; ct:extends Selector; description "Selector applying systematic count-based packet sampling to the packet stream."; reference "RFC 5475, Section 5.1; RFC 5476, Section 6.5.2.1."; leaf packetInterval { type uint32; units packets; mandatory true; description "The number of packets that are consecutively sampled between gaps of length packetSpace. This parameter corresponds to the Information Element samplingPacketInterval."; reference "RFC 5477, Section 8.2.2."; } leaf packetSpace { type uint32; units packets; mandatory true; description "The number of unsampled packets between two sampling intervals. This parameter corresponds to the Information Element samplingPacketSpace."; reference "RFC 5477, Section 8.2.3."; } } ct:complex-type SampTimeBasedSelector { if-feature psampSampTimeBased; ct:extends Selector; description "Selector applying systematic time-based packet sampling to the packet stream."; reference "RFC 5475, Section 5.1; RFC 5476, Section 6.5.2.2."; leaf timeInterval { type uint32;
units microseconds; mandatory true; description "The time interval in microseconds during which all arriving packets are sampled between gaps of length timeSpace. This parameter corresponds to the Information Element samplingTimeInterval."; reference "RFC 5477, Section 8.2.4."; } leaf timeSpace { type uint32; units microseconds; mandatory true; description "The time interval in microseconds during which no packets are sampled between two sampling intervals specified by timeInterval. This parameter corresponds to the Information Element samplingTimeInterval."; reference "RFC 5477, Section 8.2.5."; } } ct:complex-type SampRandOutOfNSelector { if-feature psampSampRandOutOfN; ct:extends Selector; description "This container contains the configuration parameters of a Selector applying n-out-of-N packet sampling to the packet stream."; reference "RFC 5475, Section 5.2.1; RFC 5476, Section 6.5.2.3."; leaf size { type uint32; units packets; mandatory true; description "The number of elements taken from the parent population. This parameter corresponds to the Information Element samplingSize."; reference "RFC 5477, Section 8.2.6."; } leaf population { type uint32; units packets; mandatory true; description "The number of elements in the parent population. This parameter corresponds to the Information Element samplingPopulation.";
reference "RFC 5477, Section 8.2.7."; } } ct:complex-type SampUniProbSelector { if-feature psampSampUniProb; ct:extends Selector; description "Selector applying uniform probabilistic packet sampling (with equal probability per packet) to the packet stream."; reference "RFC 5475, Section 5.2.2.1; RFC 5476, Section 6.5.2.4."; leaf probability { type decimal64 { fraction-digits 18; range "0..1"; } mandatory true; description "Probability that a packet is sampled, expressed as a value between 0 and 1. The probability is equal for every packet. This parameter corresponds to the Information Element samplingProbability."; reference "RFC 5477, Section 8.2.8."; } } ct:complex-type FilterMatchSelector { if-feature psampFilterMatch; ct:extends Selector; description "This container contains the configuration parameters of a Selector applying property match filtering to the packet stream."; reference "RFC 5475, Section 6.1; RFC 5476, Section 6.5.2.5."; choice nameOrId { mandatory true; description "The field to be matched is specified by either the name or the ID of the Information Element."; leaf ieName { type string; description "Name of the Information Element."; } leaf ieId { type uint16 { range "1..32767" { description "Valid range of Information Element
identifiers."; reference "RFC 5102, Section 4."; } } description "ID of the Information Element."; } } leaf ieEnterpriseNumber { type uint32; description "If present, ... "; } leaf value { type string; mandatory true; description "Matching value of the Information Element."; } } ct:complex-type FilterHashSelector { if-feature psampFilterHash; ct:extends Selector; description "This container contains the configuration parameters of a Selector applying hash-based filtering to the packet stream."; reference "RFC 5475, Section 6.2; RFC 5476, Section 6.5.2.6."; leaf hashFunction { type identityref { base "hashFunction"; } default BOB; description "Hash function to be applied. According to RFC 5475, Section 6.2.4.1, BOB hash function must be used in order to be compliant with PSAMP."; } leaf ipPayloadOffset { type uint64; units octets; default 0; description "IP payload offset ... "; reference "RFC 5477, Section 8.3.2."; } leaf ipPayloadSize { type uint64; units octets; default 8; description "Number of IP payload bytes ... "; reference "RFC 5477, Section 8.3.3.";
} leaf digestOutput { type boolean; default false; description "If true, the output ... "; reference "RFC 5477, Section 8.3.8."; } leaf initializerValue { type uint64; description "Initializer value to the hash function. If not configured by the user, the Monitoring Device arbitrarily chooses an initializer value."; reference "RFC 5477, Section 8.3.9."; } list selectedRange { key name; min-elements 1; description "List of hash function return ranges for which packets are selected."; leaf name { type nameType; description "Key of this list."; } leaf min { type uint64; description "Beginning of the hash function's selected range. This parameter corresponds to the Information Element hashSelectedRangeMin."; reference "RFC 5477, Section 8.3.6."; } leaf max { type uint64; description "End of the hash function's selected range. This parameter corresponds to the Information Element hashSelectedRangeMax."; reference "RFC 5477, Section 8.3.7."; } } } ct:complex-type Cache { ct:abstract true; description "Cache of a Monitoring Device."; key name; leaf name { type nameType; description "Key of a cache";
} leaf-list exportingProcess { type leafref { path "/ipfix/exportingProcess/name"; } description "Records are exported by all Exporting Processes in the list."; } description "Configuration and state parameters of a Cache."; container cacheLayout { description "Cache Layout."; list cacheField { key name; min-elements 1; description "List of fields in the Cache Layout."; leaf name { type nameType; description "Key of this list."; } choice nameOrId { mandatory true; description "Name or ID of the Information Element."; reference "RFC 5102."; leaf ieName { type string; description "Name of the Information Element."; } leaf ieId { type uint16 { range "1..32767" { description "Valid range of Information Element identifiers."; reference "RFC 5102, Section 4."; } } description "ID of the Information Element."; } } leaf ieLength { type uint16; units octets; description "Length of the field ... "; reference "RFC 5101, Section 6.2; RFC 5102."; } leaf ieEnterpriseNumber { type uint32; description "If present, the Information Element is enterprise-specific. ... "; reference "RFC 5101; RFC 5102."; }
leaf isFlowKey { when "(../../../cacheMode != 'immediate') and ((count(../ieEnterpriseNumber) = 0) or (../ieEnterpriseNumber != 29305))" { description "This parameter is not available for Reverse Information Elements (which have enterprise number 29305) or if the Cache Mode is 'immediate'."; } type empty; description "If present, this is a flow key."; } } } leaf dataRecords { type yang:counter64; units "Data Records"; config false; description "The number of Data Records generated ... "; reference "RFC 5815, Section 8 (ipfixMeteringProcessCacheDataRecords)."; } leaf cacheDiscontinuityTime { type yang:date-and-time; config false; description "Timestamp of the ... "; reference "RFC 5815, Section 8 (ipfixMeteringProcessCacheDiscontinuityTime)."; } } ct:complex-type ImmediateCache { if-feature cacheModeImmediate; ct:extends Cache; } ct:complex-type NonImmediateCache { ct:abstract true; ct:extends Cache; leaf maxFlows { type uint32; units flows; description "This parameter configures the maximum number of Flows in the Cache ... "; }