Table Of Contents
Table Of Contents

Statistical Policing

Goals

In this example we combine a sliding window rate meter with a probabilistic packet dropper to achieve a simple statistical policing.

INET version: 4.4

The Model

In this configuration we use a sliding window rate meter in combination with a statistical rate limiter. The former measures the thruput by summing up the packet bytes over the time window, the latter drops packets in a probabilistic way by comparing the measured datarate to the maximum allowed datarate.

Here is the network:

../../../../../_images/Network17.png

Here is the configuration:

[General]
network = inet.networks.tsn.TsnLinearNetwork
description = "Per-stream filtering using sliding window rate metering and statistical rate limiting"

# client applications
*.client.numApps = 2
*.client.app[*].typename = "UdpSourceApp"
*.client.app[0].display-name = "best effort"
*.client.app[1].display-name = "video"
*.client.app[*].io.destAddress = "server"
*.client.app[0].io.destPort = 1000
*.client.app[1].io.destPort = 1001

# best-effort stream ~40Mbps
*.client.app[0].source.packetLength = 1000B
*.client.app[0].source.productionInterval = 200us + replaceUnit(sin(dropUnit(simTime() * 10)), "ms") / 20

# video stream ~20Mbps
*.client.app[1].source.packetLength = 500B
*.client.app[1].source.productionInterval = 200us + replaceUnit(sin(dropUnit(simTime() * 20)), "ms") / 10

# enable outgoing streams
*.client.hasOutgoingStreams = true

# client stream identification
*.client.bridging.streamIdentifier.identifier.mapping = [{stream: "best effort", packetFilter: expr(udp.destPort == 1000)},
                                                         {stream: "video", packetFilter: expr(udp.destPort == 1001)}]

# client stream encoding
*.client.bridging.streamCoder.encoder.mapping = [{stream: "best effort", pcp: 0},
                                                 {stream: "video", pcp: 4}]

# server applications
*.server.numApps = 2
*.server.app[*].typename = "UdpSinkApp"
*.server.app[0].io.localPort = 1000
*.server.app[1].io.localPort = 1001

# enable per-stream filtering
*.switch.hasIngressTrafficFiltering = true

# stream decoding
*.switch.bridging.streamCoder.decoder.mapping = [{pcp: 0, stream: "best effort"},
                                                 {pcp: 4, stream: "video"}]

# per-stream filtering
*.switch.bridging.streamFilter.ingress.numStreams = 2
*.switch.bridging.streamFilter.ingress.classifier.mapping = {"best effort": 0, "video": 1}
*.switch.bridging.streamFilter.ingress.meter[0].display-name = "best effort"
*.switch.bridging.streamFilter.ingress.meter[1].display-name = "video"

# per-stream filtering
*.switch*.bridging.streamFilter.ingress.meter[*].typename = "SlidingWindowRateMeter"
*.switch*.bridging.streamFilter.ingress.meter[*].timeWindow = 10ms
*.switch*.bridging.streamFilter.ingress.filter[*].typename = "StatisticalRateLimiter"
*.switch*.bridging.streamFilter.ingress.filter[0].maxDatarate = 40Mbps
*.switch*.bridging.streamFilter.ingress.filter[1].maxDatarate = 20Mbps

Results

Here are the results:

../../../../../_images/ClientApplicationTraffic.png
../../../../../_images/BestEffortTrafficClass.png
../../../../../_images/VideoTrafficClass.png
../../../../../_images/ServerApplicationTraffic.png

Sources: omnetpp.ini

Discussion

Use this page in the GitHub issue tracker for commenting on this showcase.