module ietf-diffserv {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-diffserv";
prefix diffserv;
import ietf-traffic-policy {
prefix policy;
}
import ietf-qos-action {
prefix action;
}
import ietf-inet-types {
prefix inet;
}
import iana-qos-types {
prefix qos-types;
reference
"RFC XXXX: YANG Models for Quality of Service (QoS).";
}
organization
"IETF Routing Area Working Group";
contact
"WG Web:
WG List:
Editor: Aseem Choudhary
Editor: Mahesh Jethanandani
";
description
"This module contains a collection of YANG definitions for
configuring diffserv specification implementations.
Copyright (c) 2021 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Revised BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see
the RFC itself for full legal notices.";
revision 2023-03-10 {
description
"Initial version";
reference
"RFC XXXX: A YANG Model for Quality of Service (QoS)";
}
grouping dscp {
list dscp {
key "min max";
description
"list of dscp ranges";
leaf min {
type inet:dscp;
description
"Minimum value of dscp min-max range";
}
leaf max {
type inet:dscp;
must ". >= ../min" {
error-message
"The dscp-max must be greater than or equal to dscp-min";
}
description
"maximum value of dscp min-max range";
}
}
description
"Filter grouping containing list of dscp ranges";
}
grouping source-ipv4-prefix {
list source-ipv4-prefix {
key "prefix";
description
"list of source ipv4 prefix";
leaf prefix {
type inet:ipv4-prefix;
description
"source ipv4 prefix";
}
}
description
"Filter grouping containing list of source ipv4 prefixes";
}
grouping destination-ipv4-prefix {
list destination-ipv4-prefix {
key "prefix";
description
"list of destination ipv4 prefix";
leaf prefix {
type inet:ipv4-prefix;
description
"destination ipv4 prefix";
}
}
description
"Filter grouping containing list of destination ipv4 prefix";
}
grouping source-ipv6-prefix {
list source-ipv6-prefix {
key "prefix";
description
"list of source ipv6 prefix";
leaf prefix {
type inet:ipv6-prefix;
description
"source ipv6 prefix";
}
}
description
"Filter grouping containing list of source ipv6 prefixes";
}
grouping destination-ipv6-prefix {
list destination-ipv6-prefix {
key "prefix";
description
"list of destination ipv4 or ipv6 prefix";
leaf prefix {
type inet:ipv6-prefix;
description
"destination ipv6 prefix";
}
}
description
"Filter grouping containing list of destination ipv6 prefix";
}
grouping source-port {
list source-port {
key "min max";
description
"list of ranges of source port";
leaf min {
type inet:port-number;
description
"minimum value of source port range";
}
leaf max {
type inet:port-number;
must ". >= ../min" {
error-message
"The source-port-max must be greater than or equal to
source-port-min";
}
description
"maximum value of source port range";
}
}
description
"Filter grouping containing list of source port ranges";
}
grouping destination-port {
list destination-port {
key "min max";
description
"list of ranges of destination port";
leaf min {
type inet:port-number;
description
"minimum value of destination port range";
}
leaf max {
type inet:port-number;
must ". >= ../min" {
error-message
"The destination-port-max must be greater than or equal to
destination-port-min";
}
description
"maximum value of destination port range";
}
}
description
"Filter grouping containing list of destination port ranges";
}
grouping protocol {
list protocol {
key "min max";
description
"list of ranges of protocol values. Protocol refers to the
value in the protocol field of the ipv4 header and value
in the 'next-header' field of ipv6 header. In ipv6 header,
'next-header' field indicates first extension header or the
protocol in the 'upper-layer' header.";
reference
"RFC 791: Internet Protocol
RFC 8200: Internet Protocol, Version 6 (IPv6)
Specification";
leaf min {
type uint8 {
range "0..255";
}
description
"minimum value of protocol range";
}
leaf max {
type uint8 {
range "0..255";
}
must ". >= ../min" {
error-message
"The protocol-max must be greater than or equal to
protocol-min";
}
description
"maximum value of protocol range";
}
}
description
"Filter grouping containing list of Protocol ranges";
}
grouping traffic-group {
container traffic-group {
leaf name {
type string ;
description
"This leaf defines name of the traffic group referenced";
}
description
"traffic group container";
}
description
"traffic group grouping";
}
augment "/policy:classifiers/policy:classifier" +
"/policy:filter" {
choice filter-param {
description
"Choice of filter types";
case dscp {
uses dscp;
description
"Filter containing list of dscp ranges";
}
case source-ipv4-prefix {
uses source-ipv4-prefix;
description
"Filter containing list of source ipv4 prefixes";
}
case destination-ipv4-prefix {
uses destination-ipv4-prefix;
description
"Filter containing list of destination ipv4 prefix";
}
case source-ipv6-prefix {
uses source-ipv6-prefix;
description
"Filter containing list of source ipv6 prefixes";
}
case destination-ipv6-prefix {
uses destination-ipv6-prefix;
description
"Filter containing list of destination ipv6 prefix";
}
case source-port {
uses source-port;
description
"Filter containing list of source-port ranges";
}
case destination-port {
uses destination-port;
description
"Filter containing list of destination-port ranges";
}
case protocol {
uses protocol;
description
"Filter Type Protocol";
}
case traffic-group {
uses traffic-group;
description
"Filter Type traffic-group";
}
}
description
"augments diffserv filters to qos classifier";
}
augment "/policy:policies/policy:policy/policy:classifier" +
"/policy:inline/policy:filter" {
when "derived-from-or-self(../../../policy:type, " +
"'qos-types:ipv4-diffserv-policy-type') or " +
"derived-from-or-self(../../../policy:type, " +
"'qos-types:ipv6-diffserv-policy-type') or " +
"derived-from-or-self(../../../policy:type, " +
"'qos-types:diffserv-policy-type')" {
description
"If policy type is v4, v6 or default diffserv,
this filter can be used.";
}
choice filter-params {
description
"Choice of action types";
case dscp {
uses dscp;
description
"Filter containing list of dscp ranges";
}
case source-ipv4-prefix {
when "derived-from-or-self(/policy:policies/" +
"policy:policy/policy:type, " +
"'qos-types:ipv6-diffserv-policy-type')" {
description
"If policy type is v6, this filter cannot be used.";
}
uses source-ipv4-prefix;
description
"Filter containing list of source ipv4 prefixes";
}
case destination-ipv4-prefix {
when "derived-from-or-self(/policy:policies" +
"/policy:policy/policy:type, " +
"'qos-types:ipv6-diffserv-policy-type')" {
description
"If policy type is v6, this filter cannot be used.";
}
uses destination-ipv4-prefix;
description
"Filter containing list of destination ipv4 prefix";
}
case source-ipv6-prefix {
when "derived-from-or-self(/policy:policies" +
"/policy:policy/policy:type, "+
"'qos-types:ipv4-diffserv-policy-type')" {
description
"If policy type is v4, this filter cannot be used.";
}
uses source-ipv6-prefix;
description
"Filter containing list of source ipv6 prefixes";
}
case destination-ipv6-prefix {
when "derived-from-or-self(/policy:policies" +
"/policy:policy/policy:type, " +
"'qos-types:ipv4-diffserv-policy-type')" {
description
"If policy type is v4, this filter cannot be used.";
}
uses destination-ipv6-prefix;
description
"Filter containing list of destination ipv6 prefix";
}
case source-port {
uses source-port;
description
"Filter containing list of source-port ranges";
}
case destination-port {
uses destination-port;
description
"Filter containing list of destination-port ranges";
}
case protocol {
uses protocol;
description
"Filter Type Protocol";
}
case traffic-group {
uses traffic-group;
description
"Filter Type traffic-group";
}
}
description
"Augments Diffserv Classifier with common filter types";
}
augment "/policy:policies/policy:policy/policy:classifier" +
"/policy:action/policy:action-params" {
when "derived-from-or-self(../../policy:type, " +
"'qos-types:ipv4-diffserv-policy-type') or " +
"derived-from-or-self(../../policy:type, " +
"'qos-types:ipv6-diffserv-policy-type') or " +
"derived-from-or-self(../../policy:type, " +
"'qos-types:diffserv-policy-type')" {
description
"If policy type is v4, v6 or default diffserv,
these actions can be used.";
}
description
"Augments Diffserv Policy with action configuration";
case dscp-marking {
uses action:dscp-marking;
}
case meter-inline {
uses action:meter;
}
case meter-reference {
uses action:meter-reference;
}
case traffic-group-marking {
uses action:traffic-group-marking;
}
case child-policy {
if-feature qos-types:child-policy;
uses action:child-policy;
}
case count {
if-feature qos-types:count;
uses action:count;
}
case named-count {
if-feature qos-types:named-counter;
uses action:named-counter;
}
case queue-inline {
uses action:queue;
}
case scheduler-inline {
uses action:scheduler;
}
}
}