使用 openflow 进行速率限制

使用 openflow 进行速率限制

我正在尝试使用 Openflow 上的队列执行速率限制。我一直使用 3 个文件。一个用于创建拓扑 (top.py),一个用于创建策略 (pol.py),一个用于创建队列 (queue.py)。

该拓扑由 3 个节点(h1、h2、h3)和 3 个交换机(s1、s2、s3)组成,每个交换机都可以与每个节点通信。默认速率限制设置为 1GBps,但我尝试使用队列将其限制为 1MBps。

Top.py 包含设置为 1GBps 的节点间默认策略,该策略在 h1 和 h2 之间运行良好

S1Staticflow1 ={'switch':"00:00:00:00:00:00:00:01","name":"S1h1toh2","cookie":"0", "priority":"1","in_port":"1","eth_type":"0x800","ipv4_src":"10.0.0.1", "ipv4_dst":"10.0.0.2","active":"true","actions":"output=2"}
S1Staticflow2 ={'switch':"00:00:00:00:00:00:00:01","name":"S1h2toh1","cookie":"0", "priority":"1","in_port":"2","eth_type":"0x800","ipv4_src":"10.0.0.2", "ipv4_dst":"10.0.0.1","active":"true","actions":"output=1"}
S2Staticflow1 ={'switch':"00:00:00:00:00:00:00:02","name":"S2h2toh1","cookie":"0", "priority":"1","in_port":"1","eth_type":"0x800","ipv4_src":"10.0.0.2", "ipv4_dst":"10.0.0.1","active":"true","actions":"output=2"}
S2Staticflow2 ={'switch':"00:00:00:00:00:00:00:02","name":"S2h1toh2","cookie":"0", "priority":"1","in_port":"2","eth_type":"0x800","ipv4_src":"10.0.0.1","ipv4_dst":"10.0.0.2","active":"true","actions":"output=1"}

但是,当我尝试使用队列时,使用 set_queue,它似乎不起作用。

S1H2 = {'switch': "00:00:00:00:00:00:00:01", "name": "S1H2", "cookie": "0", "priority": "256", "in_port": "1", "eth_type": "0x800", "ipv4_src": "10.0.0.1", "ipv4_dst": "10.0.0.2", "active": "true", "actions": "output=2, set_queue=1"}
S1H1 = {'switch':"00:00:00:00:00:00:00:01","name":"S1H1","cookie":"0", "priority":"256","in_port":"2","eth_type":"0x800","ipv4_src":"10.0.0.2", "ipv4_dst":"10.0.0.1","active":"true","actions":"output=1, set_queue=1"}
S2H1 = {'switch':"00:00:00:00:00:00:00:02","name":"S2H1","cookie":"0", "priority":"256","in_port":"1","eth_type":"0x800","ipv4_src":"10.0.0.2", "ipv4_dst":"10.0.0.1","active":"true","actions":"output=2,set_queue=1"}
S2H2 = {'switch':"00:00:00:00:00:00:00:02","name":"S2H2","cookie":"0", "priority":"256","in_port":"2","eth_type":"0x800","ipv4_src":"10.0.0.1", "ipv4_dst":"10.0.0.2","active":"true","actions":"output=1,set_queue=1"}

这是我的队列实现:

queuecmd = "sudo ovs-vsctl %s -- --id=@defaultqos create qos type=linux-htb other-config:max-rate=1000000000 queues=0=@q0,1=@q1,2=@q2 -- --id=@q0 create queue other-config:max-rate=1000000000  other-config:min-rate=1000000000 -- --id=@q1 create queue other-config:max-rate=1000000 other-config:min-rate=1000000 -- --id=@q2 create queue other-config:max-rate=512000 other-config:min-rate=512000"

我正在使用 iperf3 进行测试,但无论有没有队列,速率似乎都相同。我该如何解决这个问题?

相关内容