From f3776915fa9669270cc5c682e6bab0ae033103a9 Mon Sep 17 00:00:00 2001 From: mickeyspiegel Date: Thu, 1 Apr 2021 15:32:45 -0700 Subject: [PATCH 1/4] Rename p4-dtel-metadata-semantics.yang to p4-int-metadata-semantics.yang Align with strategy to call all aspects and variants part of INT. --- ...cs.yang => p4-int-metadata-semantics.yang} | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) rename telemetry/code/models/{p4-dtel-metadata-semantics.yang => p4-int-metadata-semantics.yang} (79%) diff --git a/telemetry/code/models/p4-dtel-metadata-semantics.yang b/telemetry/code/models/p4-int-metadata-semantics.yang similarity index 79% rename from telemetry/code/models/p4-dtel-metadata-semantics.yang rename to telemetry/code/models/p4-int-metadata-semantics.yang index 8a0eea8..40658f2 100644 --- a/telemetry/code/models/p4-dtel-metadata-semantics.yang +++ b/telemetry/code/models/p4-int-metadata-semantics.yang @@ -1,11 +1,11 @@ -module p4-dtel-metadata-semantics { +module p4-int-metadata-semantics { yang-version "1"; // namespace value needs to be updated - namespace "urn:p4:yang:p4-dtel-metadata-semantics"; + namespace "urn:p4:yang:p4-int-metadata-semantics"; - prefix "dtel-md"; + prefix "int-metadata"; // import from openconfig or redefine locally? import openconfig-inet-types { prefix oc-inet; } @@ -22,12 +22,12 @@ module p4-dtel-metadata-semantics { specifications, primarily to report metadata semantics to telemetry monitoring systems."; - revision "2018-07-03" { + revision "2021-04-01" { description "Initial version"; reference "In-band Network Telemetry (INT) Dataplane Specification, - Version 1.0, 2018-04-20; - Telemetry Report Format Specification 1.0, 2018-04-20"; + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; } // identity statements @@ -112,7 +112,7 @@ module p4-dtel-metadata-semantics { // typedef statements - typedef queue-md-timing { + typedef queue-metadata-timing { type enumeration { enum ENQUEUE_TIME { description @@ -127,7 +127,7 @@ module p4-dtel-metadata-semantics { "Specifies the timing of retrieval of queue related metadata"; } - typedef int-last-hop-md-report-position { + typedef int-last-hop-metadata-report-position { type enumeration { enum EMBEDDED_INT { description @@ -155,7 +155,7 @@ module p4-dtel-metadata-semantics { // grouping statemenets - grouping dtel-md-semantics-time-units { + grouping int-metadata-semantics-time-units { description "Units of time used for specific instances of INT metadata and telemetry report metadata"; @@ -169,7 +169,7 @@ module p4-dtel-metadata-semantics { } } - grouping dtel-md-semantics-size-units { + grouping int-metadata-semantics-size-units { description "Units of size used for specific instances of INT metadata and telemetry report metadata"; @@ -194,7 +194,7 @@ module p4-dtel-metadata-semantics { } } - grouping dtel-md-semantics-utilization-units { + grouping int-metadata-semantics-utilization-units { description "Units of utilization used for specific instances of INT metadata and telemetry report metadata"; @@ -208,7 +208,7 @@ module p4-dtel-metadata-semantics { } } - grouping dtel-md-switch-id { + grouping int-metadata-switch-id { description "Switch identifier used in dataplane telemetry metadata"; @@ -220,7 +220,7 @@ module p4-dtel-metadata-semantics { } } - grouping dtel-md-metadata-supported { + grouping int-metadata-metadata-supported { description "Indicates whether a field is supported in INT metadata and telemetry report metadata"; @@ -239,58 +239,58 @@ module p4-dtel-metadata-semantics { } } - grouping dtel-md-hop-latency { + grouping int-metadata-hop-latency { description "Detailed semantics of hop latency in INT metadata and telemetry report metadata"; - uses dtel-md-semantics-time-units; + uses int-metadata-semantics-time-units; } - grouping dtel-md-queue-occupancy { + grouping int-metadata-queue-occupancy { description "Detailed semantics of queue occupancy in INT metadata and telemetry report metadata"; - uses dtel-md-semantics-size-units; + uses int-metadata-semantics-size-units; leaf packet-timing { - type queue-md-timing; + type queue-metadata-timing; description "Whether this queue occupancy was measured when the packet was enqueued, or when the packet was dequeued"; } } - grouping dtel-md-ingress-timestamp { + grouping int-metadata-ingress-timestamp { description "Detailed semantics of ingress timestamp in INT metadata and telemetry report metadata"; - uses dtel-md-semantics-time-units; + uses int-metadata-semantics-time-units; } - grouping dtel-md-egress-timestamp { + grouping int-metadata-egress-timestamp { description "Detailed semantics of egress timestamp in INT metadata and telemetry report metadata"; - uses dtel-md-semantics-time-units; + uses int-metadata-semantics-time-units; } - grouping dtel-md-egress-port-tx-utilization { + grouping int-metadata-egress-port-tx-utilization { description "Detailed semantics of egress port tx utilization INT metadata and telemetry report metadata"; - uses dtel-md-semantics-utilization-units; + uses int-metadata-semantics-utilization-units; // TBD: Need to specify something about computation // Moving average? // Time frame? } - grouping dtel-md-drop-reason { + grouping int-metadata-drop-reason { description "Detailed semantics of drop reason in telemetry report metadata"; @@ -302,13 +302,13 @@ module p4-dtel-metadata-semantics { } } - grouping dtel-md-int-last-hop-md-report { + grouping int-metadata-int-last-hop-report { description "Properties of INT last hop telemetry reports generated by this node"; - leaf int-last-hop-md-report { - type int-last-hop-md-report-position; + leaf int-last-hop-metadata-report { + type int-last-hop-metadata-report-position; description "Specifies whether last hop metadata is included in the same telemetry report as the embedded INT metadata from previous @@ -317,7 +317,7 @@ module p4-dtel-metadata-semantics { } } - grouping dtel-md-semantics-identifiers { + grouping int-metadata-semantics-identifiers { description "Identifiers used in dataplane telemetry metadata"; @@ -328,14 +328,14 @@ module p4-dtel-metadata-semantics { container config { description "switch_id config"; - uses dtel-md-switch-id; + uses int-metadata-switch-id; } container state { config false; description "State information for switch_id"; - uses dtel-md-switch-id; + uses int-metadata-switch-id; } } @@ -343,7 +343,7 @@ module p4-dtel-metadata-semantics { } - grouping dtel-md-semantics-details { + grouping int-metadata-semantics-details { description "Detailed semantics of dataplane telemetry metadata"; @@ -354,15 +354,15 @@ module p4-dtel-metadata-semantics { container config { description "Hop latency config"; - uses dtel-md-hop-latency; + uses int-metadata-hop-latency; } container state { config false; description "State information for hop latency"; - uses dtel-md-hop-latency; - uses dtel-md-metadata-supported; + uses int-metadata-hop-latency; + uses int-metadata-metadata-supported; } } @@ -373,15 +373,15 @@ module p4-dtel-metadata-semantics { container config { description "Queue occupancy config"; - uses dtel-md-queue-occupancy; + uses int-metadata-queue-occupancy; } container state { config false; description "State information for queue occupancy"; - uses dtel-md-queue-occupancy; - uses dtel-md-metadata-supported; + uses int-metadata-queue-occupancy; + uses int-metadata-metadata-supported; } } @@ -392,15 +392,15 @@ module p4-dtel-metadata-semantics { container config { description "Ingress timestamp config"; - uses dtel-md-ingress-timestamp; + uses int-metadata-ingress-timestamp; } container state { config false; description "State information for ingress timestamp"; - uses dtel-md-ingress-timestamp; - uses dtel-md-metadata-supported; + uses int-metadata-ingress-timestamp; + uses int-metadata-metadata-supported; } } @@ -411,15 +411,15 @@ module p4-dtel-metadata-semantics { container config { description "Egress timestamp config"; - uses dtel-md-egress-timestamp; + uses int-metadata-egress-timestamp; } container state { config false; description "State information for egress timestamp"; - uses dtel-md-egress-timestamp; - uses dtel-md-metadata-supported; + uses int-metadata-egress-timestamp; + uses int-metadata-metadata-supported; } } @@ -430,15 +430,15 @@ module p4-dtel-metadata-semantics { container config { description "Egress port tx utilization config"; - uses dtel-md-egress-port-tx-utilization; + uses int-metadata-egress-port-tx-utilization; } container state { config false; description "State information for egress port tx utilization"; - uses dtel-md-egress-port-tx-utilization; - uses dtel-md-metadata-supported; + uses int-metadata-egress-port-tx-utilization; + uses int-metadata-metadata-supported; } } @@ -449,65 +449,65 @@ module p4-dtel-metadata-semantics { container config { description "Drop reason config"; - uses dtel-md-drop-reason; + uses int-metadata-drop-reason; } container state { config false; description "State information for drop reason"; - uses dtel-md-drop-reason; - uses dtel-md-metadata-supported; + uses int-metadata-drop-reason; + uses int-metadata-metadata-supported; } } } - grouping dtel-md-semantics-report-properties { + grouping int-metadata-semantics-report-properties { description "Properties of telemetry reports generated by this node"; - container int-last-hop-md-report { + container int-last-hop-report-properties { description "Container for INT last hop telemetry report properties"; container config { description "INT last hop telemetry report config"; - uses dtel-md-int-last-hop-md-report; + uses int-metadata-int-last-hop-report; } container state { description "State information for INT last hop telemetry reports"; - uses dtel-md-int-last-hop-md-report; + uses int-metadata-int-last-hop-report; } } } - grouping dtel-md-semantics-top { + grouping int-metadata-semantics-top { description "Top level grouping for dataplane telemetry metadata semantics"; container identifiers { description "Identifiers used in dataplane telemetry metadata"; - uses dtel-md-semantics-identifiers; + uses int-metadata-semantics-identifiers; } - container md-semantics { + container metadata-semantics { description "Semantics of dataplane telemetry metadata"; - uses dtel-md-semantics-details; + uses int-metadata-semantics-details; } container report-properties { description "Properties of telemetry reports generated by this node"; - uses dtel-md-semantics-report-properties; + uses int-metadata-semantics-report-properties; } } // data definition statements - uses dtel-md-semantics-top; + uses int-metadata-semantics-top; } From 74ad5011efee721e1400f0fecebe3e62c7d6f9eb Mon Sep 17 00:00:00 2001 From: mickeyspiegel Date: Fri, 2 Apr 2021 15:16:38 -0700 Subject: [PATCH 2/4] Revise metadata semantics yang module for INT v2 - Replace per metadata field groupings with generic grouping that can be used for metadata semantics details of all fields - Add identity statements for each baseline metadata field - Add identity statements for three common domain specific fields - flow_id - sequence_number - mac_address - Move leafs that apply to specific metadata fields to the generic grouping, conditioning the leafs using "when" statements - Move node-id to generic grouping, conditioning this leaf when the metadata field is node_id - Remove grouping for identifiers since this is moved to generic per metadata field groupings - Add grouping for domain specific metadata details including - size in 4-byte words - INT-MX properties as defined in INT 2.1 - Add nested groupings for domain specific ids, along with bit position and identity reference for each domain specific metadata field associated with each domain --- .../models/p4-int-metadata-semantics.yang | 631 +++++++++++------- 1 file changed, 404 insertions(+), 227 deletions(-) diff --git a/telemetry/code/models/p4-int-metadata-semantics.yang b/telemetry/code/models/p4-int-metadata-semantics.yang index 40658f2..71551de 100644 --- a/telemetry/code/models/p4-int-metadata-semantics.yang +++ b/telemetry/code/models/p4-int-metadata-semantics.yang @@ -1,6 +1,6 @@ module p4-int-metadata-semantics { - yang-version "1"; + yang-version 1.1; // namespace value needs to be updated namespace "urn:p4:yang:p4-int-metadata-semantics"; @@ -22,7 +22,7 @@ module p4-int-metadata-semantics { specifications, primarily to report metadata semantics to telemetry monitoring systems."; - revision "2021-04-01" { + revision "2021-04-02" { description "Initial version"; reference "In-band Network Telemetry (INT) Dataplane Specification, @@ -30,7 +30,7 @@ module p4-int-metadata-semantics { Telemetry Report Format Specification 2.0, 2020-10-08"; } - // identity statements + // identity statements for metadata units identity METADATA_UNITS { description @@ -38,25 +38,37 @@ module p4-int-metadata-semantics { metadata"; } + identity METADATA_UNITS_IDENTIFIER { + base METADATA_UNITS; + description + "Encoding an identifier"; + } + + identity METADATA_UNITS_INTEGER { + base METADATA_UNITS; + description + "Encoding an integer"; + } + identity METADATA_TIME_UNITS { base METADATA_UNITS; description "Base identity for specifying units of time"; } - identity METADATA_NANOSECONDS { + identity METADATA_TIME_NANOSECONDS { base METADATA_TIME_UNITS; description "Encoding time in units of nanoseconds"; } - identity METADATA_FRACTIONAL_SECONDS { + identity METADATA_TIME_FRACTIONAL_SECONDS { base METADATA_TIME_UNITS; description "Encoding time in units of 2^(-32) seconds"; } - identity METADATA_MICROSECONDS { + identity METADATA_TIME_MICROSECONDS { base METADATA_TIME_UNITS; description "Encoding time in units of microseconds"; @@ -68,19 +80,19 @@ module p4-int-metadata-semantics { "Base identity for specifying units of size, e.g. queue size"; } - identity METADATA_BYTES { + identity METADATA_SIZE_BYTES { base METADATA_SIZE_UNITS; description "Encoding size in units of bytes"; } - identity METADATA_CELLS { + identity METADATA_SIZE_CELLS { base METADATA_SIZE_UNITS; description "Encoding size in units of cells"; } - identity METADATA_PACKETS { + identity METADATA_SIZE_PACKETS { base METADATA_SIZE_UNITS; description "Encoding size in units of packets"; @@ -92,27 +104,183 @@ module p4-int-metadata-semantics { "Base identity for specifying units of utilization"; } - identity METADATA_PERCENT { + identity METADATA_UTIL_PERCENT { base METADATA_UTILIZATION_UNITS; description "Encoding utilization in units of percent"; } - identity METADATA_TENTHS_OF_PERCENT { + identity METADATA_UTIL_TENTHS_OF_PERCENT { base METADATA_UTILIZATION_UNITS; description "Encoding utilization in units of tenths of percent"; } - identity METADATA_HUNDREDTHS_OF_PERCENT { + identity METADATA_UTIL_HUNDREDTHS_OF_PERCENT { base METADATA_UTILIZATION_UNITS; description "Encoding utilization in units of hundredths of percent"; } + // identity statements for metadata fields + + identity METADATA_FIELD { + description + "Base identity from which all metadata field definitions + are derived"; + } + + identity METADATA_BASELINE_FIELD { + base METADATA_FIELD; + description + "Base identity from which all baseline metadata field definitions + are derived"; + } + + identity METADATA_FIELD_NODE_ID { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Node ID"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_LEVEL_1_INTERFACE_IDS { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Level 1 Ingress Interface ID + and the Level 1 Egress Interface ID"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_HOP_LATENCY { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Hop Latency"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_QUEUE_OCCUPANCY { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Queue ID and Queue Occupancy"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_INGRESS_TIMESTAMP { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Ingress Timestamp"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_EGRESS_TIMESTAMP { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Egress Timestamp"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_LEVEL_2_INTERFACE_IDS { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Level 2 Ingress Interface ID + and the Level 2 Egress Interface ID"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_EGRESS_PORT_TX_UTILIZATION { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Egress Port TX Utilization"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_BUFFER_OCCUPANCY { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Buffer ID and Buffer Occupancy"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11; + Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_FIELD_CHECKSUM_COMPLEMENT { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Checksum Complement"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11"; + } + + identity METADATA_FIELD_DROP_REASON { + base METADATA_BASELINE_FIELD; + description + "Metadata field used to specify the Queue ID and Drop Reason"; + reference + "Telemetry Report Format Specification 2.0, 2020-10-08"; + } + + identity METADATA_DOMAIN_SPECIFIC_FIELD { + base METADATA_FIELD; + description + "Base identity from which all domain specific metadata field + definitions are derived. While some common well-known definitions + are included in this module, other domain specific metadata field + definitions may be specified in other modules."; + } + + identity METADATA_FIELD_FLOW_ID { + base METADATA_DOMAIN_SPECIFIC_FIELD; + description + "An identifier for the flow that this packet is associated with, + from the point of view of the source node. This identifier should + be unique over the lifetime of the flow."; + } + + identity METADATA_FIELD_SEQUENCE_NUMBER { + base METADATA_DOMAIN_SPECIFIC_FIELD; + description + "A number that increments for each successive packet associated with + the same flow, from the point of view of the source node"; + } + + identity METADATA_FIELD_SOURCE_MAC_ADDRESS { + base METADATA_DOMAIN_SPECIFIC_FIELD; + description + "Metadata field used to specify a MAC address associated with the + source. The MAC address is right justified within the field, with + leading 0s prepended in the MSB bits."; + } + // typedef statements - typedef queue-metadata-timing { + typedef int-queue-metadata-timing { type enumeration { enum ENQUEUE_TIME { description @@ -153,74 +321,80 @@ module p4-int-metadata-semantics { embedded INT metadata or in the Telemetry Report header"; } - // grouping statemenets - - grouping int-metadata-semantics-time-units { - description - "Units of time used for specific instances of INT metadata and - telemetry report metadata"; - - leaf time-units { - type identityref { - base METADATA_TIME_UNITS; + typedef int-ds-instruction-mode { + type enumeration { + enum EXPORT { + description + "When requested, this domain specific metadata field is + exported in each node's telemetry report"; + } + enum SOURCE_INSERTED { + description + "This domain specific metadata field is inserted by the source + node into the Optional Domain Specific Source-Inserted + Metadata in the packet"; } - description - "Units of time"; } - } - - grouping int-metadata-semantics-size-units { description - "Units of size used for specific instances of INT metadata and - telemetry report metadata"; + "Whether this domain specific metadata field is exported by each + node, or inserted into the packet by the source node"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11"; + } - leaf size-units { - type identityref { - base METADATA_SIZE_UNITS; + typedef int-source-inserted-reporting-requirement { + type enumeration { + enum ALL_NODES { + description + "Each node including the source, transit, and sink nodes + should report this source-inserted metadata to the monitoring + system along with the node's own metadata"; } - description - "Units of size"; - } - - leaf cell-size { - when "../size-units = 'METADATA_CELLS'" { + enum SINK_NODE { description - "Cell size is valid only when the size is in units of - cells"; + "The sink node should report this source-inserted metadata to + the monitoring system along with the node's own metadata"; + } + enum NONE { + description + "This source-inserted metadata is meant to be consumed by + other nodes, and need not be included in any of the telemetry + reports directed to the monitoring system"; } - type uint16; - description - "The size in bytes of one cell"; } - } - - grouping int-metadata-semantics-utilization-units { description - "Units of utilization used for specific instances of INT - metadata and telemetry report metadata"; + "Which nodes should include this source-inserted metadata field + in telemetry reports"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11"; + } - leaf utilization-units { - type identityref { - base METADATA_UTILIZATION_UNITS; + typedef int-source-inserted-metadata-mutability { + type enumeration { + enum SOURCE_ONLY { + description + "The source node inserts the metadata. Transit and sink nodes + must not change the value of this source-inserted metadata."; + } + enum CUMULATIVE { + description + "Transit and sink nodes may update or replace the value of the + source-inserted metadata"; } - description - "Units of utilization"; } - } - - grouping int-metadata-switch-id { description - "Switch identifier used in dataplane telemetry metadata"; - - leaf switch-id { - type uint32; - description - "The switch_id value that this node inserts in INT metadata - and telemetry report metadata"; - } + "Whether this metadata field may be updated or replaced by transit + and sink nodes"; + reference + "In-band Network Telemetry (INT) Dataplane Specification, + Version 2.1, 2020-11-11"; } - grouping int-metadata-metadata-supported { + // grouping statemenets + + grouping int-metadata-field-supported { description "Indicates whether a field is supported in INT metadata and telemetry report metadata"; @@ -239,248 +413,249 @@ module p4-int-metadata-semantics { } } - grouping int-metadata-hop-latency { + grouping int-metadata-domain-specific-field-details { description - "Detailed semantics of hop latency in INT metadata and - telemetry report metadata"; + "Properties of domain specific fields"; - uses int-metadata-semantics-time-units; - } + leaf size { + type uint8 { + range "1..8"; + } + default 1; + description + "The size of the domain specific field in 4-byte words"; + } - grouping int-metadata-queue-occupancy { - description - "Detailed semantics of queue occupancy in INT metadata and - telemetry report metadata"; + leaf ds-instruction-mode { + type int-ds-instruction-mode; + default EXPORT; + description + "For INT-MX packets, whether this domain specific metadata field + is exported by each node, or inserted into the packet by the + source node"; + } - uses int-metadata-semantics-size-units; + leaf source-inserted-reporting-requirement { + when "../ds-instruction-mode = 'SOURCE_INSERTED'"; + type int-source-inserted-reporting-requirement; + default ALL_NODES; + description + "For INT-MX packets, which nodes should include this + source-inserted metadata field in telemetry reports"; + } - leaf packet-timing { - type queue-metadata-timing; + leaf source-inserted-metadata-mutability { + when "../ds-instruction-mode = 'SOURCE_INSERTED'"; + type int-source-inserted-metadata-mutability; + default SOURCE_ONLY; description - "Whether this queue occupancy was measured when the packet - was enqueued, or when the packet was dequeued"; + "For INT-MX packets, whether this source-inserted metadata field + may be updated or replaced by transit and sink nodes"; } } - grouping int-metadata-ingress-timestamp { + grouping int-metadata-field-details { description - "Detailed semantics of ingress timestamp in INT metadata and - telemetry report metadata"; - - uses int-metadata-semantics-time-units; - } + "Detailed semantics of a particular metadata field"; - grouping int-metadata-egress-timestamp { - description - "Detailed semantics of egress timestamp in INT metadata and - telemetry report metadata"; + leaf units { + type identityref { + base METADATA_UNITS; + } + description + "The units that are used when this node adds this metadata field"; + } - uses int-metadata-semantics-time-units; - } + leaf cell-size { + when "../units = 'METADATA_SIZE_CELLS'" { + description + "Cell size is valid only when the size is in units of cells"; + } + type uint16; + description + "The size in bytes of one cell"; + } - grouping int-metadata-egress-port-tx-utilization { - description - "Detailed semantics of egress port tx utilization INT metadata - and telemetry report metadata"; + leaf node-id { + when "../../metadata-field-id = 'METADATA_FIELD_NODE_ID'"; + type uint32; + description + "The node_id value that this node inserts in INT metadata + and telemetry report metadata"; + } - uses int-metadata-semantics-utilization-units; + leaf packet-timing { + when "../../metadata-field-id[.='METADATA_FIELD_QUEUE_OCCUPANCY' or + .='METADATA_FIELD_BUFFER_OCCUPANCY']"; + type int-queue-metadata-timing; + description + "Whether this queue or buffer occupancy was measured when the + packet was enqueued, or when the packet was dequeued"; + } - // TBD: Need to specify something about computation + // TBD: Need to specify something about Egress Tx Port Util computation? // Moving average? // Time frame? - } - - grouping int-metadata-drop-reason { - description - "Detailed semantics of drop reason in telemetry report - metadata"; leaf drop-reason-reference { + when "../../metadata-field-id = 'METADATA_FIELD_DROP_REASON'"; type oc-inet:url; description "A reference to a URL where the drop reasons are defined"; } - } - - grouping int-metadata-int-last-hop-report { - description - "Properties of INT last hop telemetry reports generated by - this node"; - leaf int-last-hop-metadata-report { - type int-last-hop-metadata-report-position; - description - "Specifies whether last hop metadata is included in the same - telemetry report as the embedded INT metadata from previous - hops, and whether the last hop metadata is included in - embedded INT metadata or in the Telemetry Report header"; + uses int-metadata-domain-specific-field-details { + // Note: "derived-from" is only present in YANG 1.1, not 1.0 + // OpenConfig does not yet support YANG 1.1 + when "derived-from(../metadata-field-id, + 'METADATA_DOMAIN_SPECIFIC_FIELD')"; } } - grouping int-metadata-semantics-identifiers { + grouping int-metadata-semantics-details { description - "Identifiers used in dataplane telemetry metadata"; + "Detailed semantics of dataplane telemetry metadata"; - container switch-id { + list metadata-field { + key "metadata-field-id"; description - "Container for switch_id"; + "A list of INT metadata fields known to this implementation, + along with related details such as units and clarification of + semantics"; + + leaf metadata-field-id { + type identityref { + base METADATA_FIELD; + } + description + "A metadata field whose detailed semantics are reported and + optionally configured"; + } container config { description - "switch_id config"; - uses int-metadata-switch-id; + "Configuration of units and semantics for this field"; + uses int-metadata-field-details; } container state { config false; description - "State information for switch_id"; - uses int-metadata-switch-id; + "State information for this field"; + uses int-metadata-field-details; + uses int-metadata-field-supported; } } - - // TBD: Add anything related to port IDs? - } - grouping int-metadata-semantics-details { + grouping int-metadata-int-last-hop-report { description - "Detailed semantics of dataplane telemetry metadata"; + "Properties of INT last hop telemetry reports generated by + this node"; - container hop-latency { + leaf int-last-hop-metadata-report { + type int-last-hop-metadata-report-position; description - "Container for hop latency"; - - container config { - description - "Hop latency config"; - uses int-metadata-hop-latency; - } - - container state { - config false; - description - "State information for hop latency"; - uses int-metadata-hop-latency; - uses int-metadata-metadata-supported; - } + "Specifies whether last hop metadata is included in the same + telemetry report as the embedded INT metadata from previous + hops, and whether the last hop metadata is included in + embedded INT metadata or in the Telemetry Report header"; } + } - container queue-occupancy { - description - "Container for queue occupancy"; - - container config { - description - "Queue occupancy config"; - uses int-metadata-queue-occupancy; - } - - container state { - config false; - description - "State information for queue occupancy"; - uses int-metadata-queue-occupancy; - uses int-metadata-metadata-supported; - } - } + grouping int-metadata-semantics-report-properties { + description + "Properties of telemetry reports generated by this node"; - container ingress-timestamp { + container int-last-hop-report-properties { description - "Container for ingress timestamp"; + "Container for INT last hop telemetry report properties"; container config { description - "Ingress timestamp config"; - uses int-metadata-ingress-timestamp; + "INT last hop telemetry report config"; + uses int-metadata-int-last-hop-report; } container state { config false; description - "State information for ingress timestamp"; - uses int-metadata-ingress-timestamp; - uses int-metadata-metadata-supported; + "State information for INT last hop telemetry reports"; + uses int-metadata-int-last-hop-report; } } + } - container egress-timestamp { - description - "Container for egress timestamp"; - - container config { - description - "Egress timestamp config"; - uses int-metadata-egress-timestamp; - } + grouping int-metadata-domain-specific-field { + description + "Properties of a metadata field used by this specific domain"; - container state { - config false; - description - "State information for egress timestamp"; - uses int-metadata-egress-timestamp; - uses int-metadata-metadata-supported; + leaf domain-specific-metadata-field-id { + type identityref { + base METADATA_DOMAIN_SPECIFIC_FIELD; } + description + "A metadata field that is used by this specific domain"; } + } - container egress-port-tx-utilization { - description - "Container for egress port tx utilization"; + grouping int-metadata-for-specific-domain { + description + "The domain specific metadata used by a particular domain, + including the identity references and bit positions for each + associated domain specific metadata field."; - container config { - description - "Egress port tx utilization config"; - uses int-metadata-egress-port-tx-utilization; - } + list domain-specific-metadata { + key "domain-metadata-bit-position"; + description + "A list of the domain specific metadata used by a particular + domain"; - container state { - config false; + leaf domain-metadata-bit-position { + type int8 { + range "0..15"; + } description - "State information for egress port tx utilization"; - uses int-metadata-egress-port-tx-utilization; - uses int-metadata-metadata-supported; + "The bit position in the INT DS Instruction field or the + Telemetry Report DSMdBits field used for this metadata field. + The value 0 represents the MSB and 15 represents the LSB."; } - } - - container drop-reason { - description - "Container for drop reason"; container config { description - "Drop reason config"; - uses int-metadata-drop-reason; + "Domain specific metadata configuration"; + uses int-metadata-domain-specific-field; } container state { config false; description - "State information for drop reason"; - uses int-metadata-drop-reason; - uses int-metadata-metadata-supported; + "State information for domain specific metadata"; + uses int-metadata-domain-specific-field; } } } - grouping int-metadata-semantics-report-properties { + grouping int-metadata-domain-specific-metadata { description - "Properties of telemetry reports generated by this node"; + "Domain specific IDs known to this node, including the identity + references and bit positions for each associated domain + specific metadata field"; - container int-last-hop-report-properties { + list domain { + key "domain-specific-id"; description - "Container for INT last hop telemetry report properties"; + "A list of domains known to this node, along with the details of + the domain specific metadata used by each domain"; - container config { + leaf domain-specific-id { + type uint16; description - "INT last hop telemetry report config"; - uses int-metadata-int-last-hop-report; + "A domain specific ID, identifying a domain that has specific + metadata definitions"; } - container state { - description - "State information for INT last hop telemetry reports"; - uses int-metadata-int-last-hop-report; - } + uses int-metadata-for-specific-domain; } } @@ -488,12 +663,6 @@ module p4-int-metadata-semantics { description "Top level grouping for dataplane telemetry metadata semantics"; - container identifiers { - description - "Identifiers used in dataplane telemetry metadata"; - uses int-metadata-semantics-identifiers; - } - container metadata-semantics { description "Semantics of dataplane telemetry metadata"; @@ -505,6 +674,14 @@ module p4-int-metadata-semantics { "Properties of telemetry reports generated by this node"; uses int-metadata-semantics-report-properties; } + + container domain-specific-metadata { + description + "Domain specific IDs known to this node, including the identity + references and bit positions for each associated domain + specific metadata field"; + uses int-metadata-domain-specific-metadata; + } } // data definition statements From bfdb4fb74af2e307037653431b9be6349173fe29 Mon Sep 17 00:00:00 2001 From: mickeyspiegel Date: Mon, 5 Apr 2021 11:40:22 -0700 Subject: [PATCH 3/4] Add support for timestamp units of PTP, NTP, POSIX Also add support for bit field and boolean. --- .../models/p4-int-metadata-semantics.yang | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/telemetry/code/models/p4-int-metadata-semantics.yang b/telemetry/code/models/p4-int-metadata-semantics.yang index 71551de..9529d69 100644 --- a/telemetry/code/models/p4-int-metadata-semantics.yang +++ b/telemetry/code/models/p4-int-metadata-semantics.yang @@ -50,6 +50,18 @@ module p4-int-metadata-semantics { "Encoding an integer"; } + identity METADATA_UNITS_BIT_FIELD { + base METADATA_UNITS; + description + "Encoding a bit field, where each bit represents a separate flag"; + } + + identity METADATA_UNITS_BOOLEAN { + base METADATA_UNITS; + description + "Encoding a boolean"; + } + identity METADATA_TIME_UNITS { base METADATA_UNITS; description @@ -74,6 +86,47 @@ module p4-int-metadata-semantics { "Encoding time in units of microseconds"; } + identity METADATA_TIME_PTP_TRUNCATED_TIMESTAMP { + base METADATA_TIME_UNITS; + description + "The 64 least significant bits of the 80-bit PTP timestamp. + The first four bytes specify the integer portion of the number + of seconds since the epoch, 1 January 1970 00:00:00 TAI, which + is 31 December 1969 23:59:51.999918 UTC. The last four bytes + specify the fractional portion of the number of seconds since + the epoch, in nanoseconds."; + reference + "IEEE 1588-2008 - IEEE Standard for a Precision Clock + Synchronization Protocol for Networked Measurement and Control + Systems"; + } + + identity METADATA_TIME_NTP_64_TIMESTAMP { + base METADATA_TIME_UNITS; + description + "The first four bytes specify the integer portion of the number + of seconds since the epoch, 1 January 1900 00:00 UTC. The last + four bytes specify the fractional portion of the number of + seconds since the epoch, in units of 2^(-32) seconds, which is + roughly equal to 233 picoseconds."; + reference + "Network Time Protocol Version 4: Protocol and Algorithms + Specification, RFC 5905, June 2010"; + } + + identity METADATA_TIME_POSIX_TIMESTAMP { + base METADATA_TIME_UNITS; + description + "The first four bytes specify the integer portion of the number + of seconds since the epoch, 1 January 1970 00:00:00 TAI, which + is 31 December 1969 23:59:51.999918 UTC. The last four bytes + specify the fractional portion of the number of seconds since + the epoch, in microseconds."; + reference + "IEEE Std 1003.1-2008 - IEEE Standard for Information Technology + - Portable Operating System Interface (POSIX(R))"; + } + identity METADATA_SIZE_UNITS { base METADATA_UNITS; description From a39a53f6ed26e5cc6a1fab0c95ed971be964b039 Mon Sep 17 00:00:00 2001 From: mickeyspiegel Date: Mon, 5 Apr 2021 12:23:39 -0700 Subject: [PATCH 4/4] Add drop reason map Map between drop reason codepoints and identityrefs to drop reason name and semantics. The identity statements for the many drop reasons are to be added in future commits. --- .../models/p4-int-metadata-semantics.yang | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/telemetry/code/models/p4-int-metadata-semantics.yang b/telemetry/code/models/p4-int-metadata-semantics.yang index 9529d69..3811e80 100644 --- a/telemetry/code/models/p4-int-metadata-semantics.yang +++ b/telemetry/code/models/p4-int-metadata-semantics.yang @@ -331,6 +331,22 @@ module p4-int-metadata-semantics { leading 0s prepended in the MSB bits."; } + // identity statements for drop reasons + + identity METADATA_DROP_REASON { + description + "Base identity from which all metadata drop reasons are derived"; + } + + // TBD: Add identity for each well-known drop reason + // For now just add one drop reason to show the format + + identity METADATA_DROP_REASON_TAIL_DROP { + base METADATA_DROP_REASON; + description + "Packets dropped when queue buffers become full/overflow"; + } + // typedef statements typedef int-queue-metadata-timing { @@ -712,6 +728,53 @@ module p4-int-metadata-semantics { } } + grouping int-metadata-drop-reason-identity { + description + "Properties of a metadata field used by this specific domain"; + + leaf drop_reason_identity { + type identityref { + base METADATA_DROP_REASON; + } + description + "Identifies the reason that one or more packets were dropped"; + } + } + + grouping int-metadata-drop-reason-map { + description + "The mapping between drop reason codepoints and identity + references to drop reason names and semantics"; + + list drop_reason { + key "drop_reason_codepoint"; + description + "A list of drop reason codepoints and their mappings to drop + reason names and semantics"; + + leaf drop_reason_codepoint { + type uint8; + description + "The numerical value used in telemetry reports generated by + this node, when a packet is dropped for this particular + reason"; + } + + container config { + description + "Drop reason configuration"; + uses int-metadata-drop-reason-identity; + } + + container state { + config false; + description + "State information for drop reasons"; + uses int-metadata-drop-reason-identity; + } + } + } + grouping int-metadata-semantics-top { description "Top level grouping for dataplane telemetry metadata semantics"; @@ -735,6 +798,13 @@ module p4-int-metadata-semantics { specific metadata field"; uses int-metadata-domain-specific-metadata; } + + container drop_reason_map { + description + "The mapping between drop reason code values and identity + references to drop reason names and semantics"; + uses int-metadata-drop-reason-map; + } } // data definition statements