macauley_cheng | 502976c | 2015-11-06 11:40:31 +0800 | [diff] [blame] | 1 | import logging
|
| 2 | import oftest.base_tests as base_tests
|
| 3 | from oftest import config
|
| 4 | from oftest.testutils import *
|
| 5 | from util import *
|
| 6 | from accton_util import convertIP4toStr as toIpV4Str
|
| 7 | from accton_util import convertMACtoStr as toMacStr
|
| 8 |
|
| 9 | """
|
| 10 | Not Verify yet, need to think how to verify meter
|
| 11 | """
|
| 12 |
|
| 13 | class wred(base_tests.SimpleDataPlane):
|
| 14 | """
|
| 15 | [WRED]
|
| 16 | WRED (DCTCP)
|
| 17 |
|
| 18 | Inject eth 1/1 untag, SA000000112233, DA000000000111, TCP ECN 01 [100%]
|
| 19 | Output eth 1/5 ECN 11
|
| 20 |
|
| 21 | [CLI] interface eth 1/1 => switch priority default 1
|
| 22 | dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20005 group=any,port=any,weight=0 output=5
|
| 23 | dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1000/0xfff apply:set_field=vlan_vid=2 goto:20
|
| 24 | dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1000/0xfff apply:set_field=vlan_vid=2 goto:20
|
| 25 | dpctl tcp:192.168.1.1:6633 flow-mod table=60,cmd=add,prio=601 in_port=3 write:group=0x20005
|
| 26 | dpctl tcp:192.168.1.1:6633 flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port=1 write:group=0x20005
|
| 27 | dpctl tcp:192.168.1.1:6633 queue-mod type=wred,port=5,queue=0 min=1,max=60,ecn=100,drop=100
|
| 28 | """
|
| 29 | def runTest(self):
|
| 30 | delete_all_flows(self.controller)
|
| 31 | delete_all_groups(self.controller)
|
| 32 |
|
| 33 | test_ports = sorted(config["port_map"].keys())
|
| 34 |
|
| 35 | input_port = test_ports[0]
|
| 36 | input_port2 = test_ports[1]
|
| 37 | output_port = test_ports[2]
|
| 38 |
|
| 39 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 40 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1000/0xfff apply:set_field=vlan_vid=2 goto:20")
|
| 41 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port2)+",vlan_vid=0x1000/0xfff apply:set_field=vlan_vid=2 goto:20")
|
| 42 | apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 in_port="+str(input_port2)+" write:group=0x2000"+str(output_port))
|
| 43 | apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x2000"+str(output_port))
|
| 44 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=200/0xfff,eth_dst=00:00:00:00:02:00,eth_type=0x0800 goto:28")
|
| 45 | apply_dpctl_mod(self, config, "queue-mod type=wred,port="+str(output_port)+",queue=0 min=1,max=60,ecn=100,drop=100")
|
| 46 |
|
| 47 | # TCP ecn = 01
|
| 48 | input_pkt = simple_packet(
|
| 49 | '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '
|
| 50 | '08 00 45 01 00 4e 04 d2 00 00 7f 06 b2 7b c0 a8 '
|
| 51 | '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '
|
| 52 | '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '
|
| 53 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 54 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 55 |
|
| 56 | # TCP ecn = 00
|
| 57 | input_pkt2 = simple_packet(
|
| 58 | '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '
|
| 59 | '08 00 45 00 00 4e 04 d2 00 00 7f 06 b2 7b c0 a8 '
|
| 60 | '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '
|
| 61 | '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '
|
| 62 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 63 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 64 |
|
| 65 | # TCP ecn = 11
|
| 66 | output_pkt = simple_packet(
|
| 67 | '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '
|
| 68 | '08 00 45 11 00 4e 04 d2 00 00 7f 06 b2 7b c0 a8 '
|
| 69 | '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '
|
| 70 | '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '
|
| 71 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 72 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 73 |
|
| 74 | self.dataplane.send(input_port, str(input_pkt))
|
| 75 | self.dataplane.send(input_port2, str(input_pkt2))
|
| 76 | verify_packet(self, str(output_pkt), output_port)
|
| 77 |
|