# TR-181 Data Model Reference

The QoS Manager implements the `Device.QoS.` data model per TR-181 Issue 2. All parameters can be accessed via the USP Agent.

## Device.QoS. (Top-Level)

| Parameter | R/W | Type | Description |
|---|---|---|---|
| ClassificationNumberOfEntries | R | uint | Number of Classification entries |
| QueueNumberOfEntries | R | uint | Number of Queue entries |
| QueueStatsNumberOfEntries | R | uint | Number of QueueStats entries |
| ShaperNumberOfEntries | R | uint | Number of Shaper entries |
| PolicerNumberOfEntries | R | uint | Number of Policer entries |
| MaxClassificationEntries | R | uint | Maximum classification entries (50) |
| MaxQueueEntries | R | uint | Maximum queue entries (100) |
| MaxPolicerEntries | R | uint | Maximum policer entries (50) |

## Device.QoS.Classification.{i}.

| Parameter | R/W | UCI mapping | Description |
|---|---|---|---|
| Enable | RW | enable | Enable/disable this classifier |
| Order | RW | order | Execution priority (lower first) |
| Alias | RW | (section name) | Unique identifier |
| Interface | RW | ifname | Reference to Device.Ethernet.Interface.{i}. or Device.IP.Interface.{i}. |
| AllInterfaces | RW | all_interfaces | Apply to all interfaces |
| SourceIP | RW | src_ip | Source IP address |
| SourceMask | RW | src_ip (CIDR) | Source IP mask |
| DestIP | RW | dest_ip | Destination IP address |
| DestMask | RW | dest_ip (CIDR) | Destination IP mask |
| SourcePort | RW | src_port | Source L4 port |
| SourcePortRangeMax | RW | src_port_range | Source port range end |
| DestPort | RW | dest_port | Destination L4 port |
| DestPortRangeMax | RW | dst_port_range | Destination port range end |
| Protocol | RW | proto | IP protocol number |
| SourceMACAddress | RW | src_mac | Source MAC address |
| DestMACAddress | RW | dst_mac | Destination MAC address |
| Ethertype | RW | ethertype | Ethernet type field |
| VLANIDCheck | RW | vid_check | Match VLAN ID |
| EthernetPriorityCheck | RW | pcp_check | Match 802.1p P-bit |
| DSCPCheck | RW | dscp_filter | Match DSCP value (-1 = disabled) |
| IPLengthMin | RW | ip_len_min | Min IP packet length |
| IPLengthMax | RW | ip_len_max | Max IP packet length |
| TrafficClass | RW | traffic_class | Queue assignment (0-7, -1 = disabled) |
| DSCPMark | RW | dscp_mark | DSCP value to write (-2 = disabled) |
| EthernetPriorityMark | RW | pcp_mark | P-bit value to write (-2 = disabled) |
| X_IOWRT_EU_VLANIDMark | RW | vid_mark | VLAN ID to write (-1 = disabled) |
| ForwardingPolicy | RW | forwarding_policy | fwmark tag set on matched packets; Device.Routing.Policy.ForwardingPolicy selects the routing table |
| Policer | RW | policer | Reference to Device.QoS.Policer.{i}. |
| SourceVendorClassID | RW | src_vendor_class_id | DHCPv4 Option 60 match |
| DestVendorClassID | RW | dest_vendor_class_id | DHCPv4 Option 60 match |
| SourceUserClassID | RW | src_user_class_id | DHCPv4 Option 77 match |
| DestUserClassID | RW | dest_user_class_id | DHCPv4 Option 77 match |
| SourceClientID | RW | src_client_id | DHCPv4 Option 61 match |
| DestClientID | RW | dest_client_id | DHCPv4 Option 61 match |

## Device.QoS.Queue.{i}.

| Parameter | R/W | UCI mapping | Description |
|---|---|---|---|
| Enable | RW | enable | Enable/disable queue |
| Status | R | - | Enabled/Disabled |
| Alias | RW | (section name) | Unique queue identifier |
| Interface | RW | ifname | Reference to interface object |
| Precedence | RW | precedence | Queue priority (lower = higher) |
| SchedulerAlgorithm | RW | scheduling | SP, WRR, or WFQ |
| Weight | RW | weight | WRR weight |
| ShapingRate | RW | rate | Per-queue rate in bps (-1 = unlimited) |
| ShapingBurstSize | RW | burst_size | Burst size in bytes |

## Device.QoS.QueueStats.{i}.

| Parameter | R/W | Description |
|---|---|---|
| Enable | RW | Enable statistics collection |
| Status | R | Enabled/Disabled |
| Alias | RW | Unique identifier |
| Queue | RW | Reference to Device.QoS.Queue.{i}. |
| Interface | RW | Reference to interface object |
| OutputPackets | R | Total transmitted packets (64-bit) |
| OutputBytes | R | Total transmitted bytes (64-bit) |
| DroppedPackets | R | Total dropped packets (64-bit) |
| DroppedBytes | R | Total dropped bytes (64-bit) |

## Device.QoS.Shaper.{i}.

| Parameter | R/W | UCI mapping | Description |
|---|---|---|---|
| Enable | RW | enable | Enable/disable shaper |
| Status | R | - | Enabled/Disabled |
| Alias | RW | (section name) | Unique identifier |
| Interface | RW | ifname | Reference to interface object |
| ShapingRate | RW | rate | Rate in bps (-1 = unlimited) |
| ShapingBurstSize | RW | burst_size | Burst size in bytes |

## Device.QoS.Policer.{i}.

| Parameter | R/W | UCI mapping | Description |
|---|---|---|---|
| Enable | RW | enable | Enable/disable policer |
| Status | R | - | Enabled/Disabled |
| Alias | RW | (section name) | Unique identifier |
| CommittedRate | RW | committed_rate | CIR in bps (min 1000) |
| CommittedBurstSize | RW | committed_burst_size | CBS in bytes |
| ExcessBurstSize | RW | excess_burst_size | EBS in bytes |
| PeakRate | RW | peak_rate | PIR in bps |
| PeakBurstSize | RW | peak_burst_size | PBS in bytes |
| MeterType | RW | meter_type | SimpleTokenBucket, SingleRateThreeColor, TwoRateThreeColor |
| PossibleMeterTypes | R | - | Supported meter types |

---

## USP Agent Usage

The TR-181 data model can be queried and modified through the USP Agent (`obuspa`):

```bash
# Get all QoS parameters
obuspa -c get Device.QoS.

# Get queue stats
obuspa -c get Device.QoS.QueueStats.

# Get a specific classification rule
obuspa -c get Device.QoS.Classification.1.

# Set a parameter
obuspa -c set Device.QoS.Classification.1.Enable true

# Add a new object instance
obuspa -c add Device.QoS.Classification.

# Delete an object instance
obuspa -c del Device.QoS.Classification.3.
```
